Anyone knows why the below ifelse throw me error in the calculated field? thank you
error from the calculated field:
ifelse({formatted_date}=formatDate(now(), ‘MM/dd/yyyy’),{Count_Days},0)
If {Count_Days} is a calculated field which is using the COUNT() aggregated function, then your ifelse statement will give an error due to Mismatched Aggregation.
You would need to change it to the following form instead:
count(
ifelse({formatted_date}=formatDate(now(), ‘MM/dd/yyyy’),{Days},0)
)
Related
enter image description here
I need to create a column which subtracts [Retailer_yes_amount] and [classification_base_amount] and at the same time filter out "Not Eligible" category in [Classification] column. [Classification] column has 5 categories - Platinum, Gold, Silver, Bronze and Not eligible.
I was thinking like this New_column = calculate(([Retailer_yes_amount]-[classification_base_amount]),filter('table_name',[classification] <> "Not Eligible")) but it threw an error.
Kindly suggest
If you want to have this evaluated for every row as a new column you have to enter the following expression as a Calculated Column
New_column =
IF(
table_name[Classification] <> "Not Eligible",
[Retailer_yes_amount] - [classification_base_amount]
)
If you want to use a measure you have to specify an aggregation.
I am trying to recreate the following calculation from PowerBI in Tableau but I am not sure how to achieve what FILTER() function does.
(CALCULATE(SUM(Data[Amount]),FILTER(Data,Data[Paid]="True"))/SUM(Data[Amount]) +
CALCULATE(COUNT(Data[Document ID]),FILTER(Data,Data[Paid]="True"))/COUNT(Data[Document ID]))/2
My assumption was to use IF or CASE but then I couldn't figure out how to divide by number of all documents, regardless of their payment status.
I suppose you need the following:
SUM(IF [paid] = "True" then [Amount] end)/SUM([Amount])
+
COUNT(IF [paid] = "True" then [Document ID] end)/COUNT([Document ID])/2
The filter is specified using the if statement.
im' working with analysis services. I need to perform a calculation and for this i use kpi. In the field "value expression" from KPI i establishid the calculation with an expression MDX. Works fine but i don't know how put the clause "WHERE" in the query o how use it
(([Measures].[Recuento Factonlymatriculacion],[Dimmatriculacion].[Nivel].&[Universitario])*100)/([Measures].[Recuento Factsolicitud],[Dimplan].[Nivel].&[Universitario]))
WHERE
([Measures].[Recuento Factsolicitud],[Dimaniosolicitud].[Anio]) IS ([Measures].[Recuento Factmatriculacion],[Dimmatriculacion].[Anio])
I don't think you need WHERE. Just form a two part tuple, with Anio as the second part:
(
DIVIDE(
([Measures].[Recuento Factonlymatriculacion],[Dimmatriculacion].[Nivel].&[Universitario] * 100),
[Measures].[Recuento Factsolicitud],[Dimplan].[Nivel].&[Universitario]
)
, [Measures].[Recuento Factmatriculacion],[Dimmatriculacion].[Anio]
)
But there looks to be an issue as Anio is part of Measures so I don't understand how your original logic will return anything other than blank?
I am investigating a problem about Calculated Measures format issue from an OLAP Cube.
I get these numbers :
I am using this mdx request:
WITH MEMBER [Measures].[Ristournable Format] AS [Measures].[Ristournable], FORMAT_STRING = 'Currency'
SELECT
NON EMPTY { [Measures].[Ristournable Format] } ON COLUMNS,
NON EMPTY { ([Affaire].[Affaire].[Affaire].ALLMEMBERS ) } ON ROWS
FROM [CUBE]
But it doesn't work. I think the problem comes from the "." instand of "," for the numbers so my MDX request is using it as String. That's why I tried to force the numeric conversion with the first sentence "WITH MEMBER ...". Unfortunately this doesn't work either.
Could you please help me to solve it?
Have you tried FORMAT_STRING='$##0.00' or some other explicit way of telling MDX exactly what you want, rather than just passing 'Currency'?
I'm new to Cognos Reporting and I'm wondering there is a way to create models/queries that are conditional. For example:
"if x is not null then append this 'where line' to query"
Something like that, I'm still pretty new to Cognos so I may be using the wrong words.
Please help me out.
Thanks.
If you want to filter rows of a query subject,
Right click your query subject> Edit Defition> Filters Tab > Add a filter
In the expression definition box,
x is null or (x is not null and <where expression to append>)
If you want to apply the filter for a query item
case
when x is not null and <where expression to append>
then <some_query_item>
else <some_query_item>
end