Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Experts,
I have a trouble using DAX function: MAX.
I want to get a unique value from Text column to use switch to use different calculation for each category in one measure.
In Power BI Desktop not using SSAS Tabular, I could make MAX function with Text column.
e.g. Measure = IF(MAX('Table'[TextColumn]) = "A"), Value, Blank())
The Table looks like this.
Category | Date | Value |
A | 2019-01-03 | 100 |
B | 2019-01-03 | 80 |
C | 2020-01-03 | 140 |
A | 2020-01-04 | 570 |
B | 2020-01-04 | 130 |
C | 2020-01-04 | 330 |
However, whenever I use the same function in SSAS Tabular, it makes error with message like this.
"the function max takes an argument that evaluates to numbers or dates dax... "
I have used MAX function to get unique value from text column in DAX function, but I'm stuck in trouble because it doesn't work in SSAS Tabular.
Please give me any idea to solve this issue.
Thanks.
did you ever find a solution to this? running into the exact problem now, and can't think of a way to workaround it
Perhaps LASTNONBLANK ?
That's good to know about the MAX function because I use it all the time with text columns.
Thanks Greg,
Have you usually used MAX function in Power BI like in my situation as well?
Did you try the same function in SSAS Tabular(SSDT) to make measure in it?
When Power BI is connected with SSAS Tabular is the same, it doesn't work MAX function even I make report level measure in Power BI.
Yes, It is very strange.
I cannot figure out any clue at all that can make different work.
Could you please review below DAX expression.
TEST_:=
IF(LASTNONBLANK('FactPayment'[Category], "SUM_PAY_AMT_KRW") , [Payment_KRW (AS-IS)],BLANK())
It makes error in SSAS tabular.
Thanks in advance.
@Anonymous
Do you have experience that worked the SELECTEDVALUE function in SSAS?
Do you mean my expression:
TEST_:=
IF(MAX('FactPayment'[Category], "SUM_PAY_AMT_KRW") , [Payment_KRW (AS-IS)], BLANK())
change into like below...?
IF(SELECTEDVALUE('FactPayment'[Category], "SUM_PAY_AMT_KRW") , [Payment_KRW (AS-IS)], BLANK())
I do not have any knowledge with the function, if my expression with SELECTEDVALUE is wrong, please correct it.
I tried MAX, LASTNONBLANK, FIRSTNONBLANK... but all of the function made error in SSAS...
the way you wrote it, you perhaps tried to do this instead
e.g. Measure = IF(MAX('Table'[TextColumn]) = "A", Value, Blank())
there was an extra ")"
don't know if it helps
Hi @DanielLinda ,
Based on my test using Power Bi version : 2.80.5803.1061 64-bit .I cannot reproduce your issue here. Could you please update your Power bi desktop and check again?
Or we can try this formula.
IF(value('Table'[TextColumn]) = "A", Value, Blank())
Thanks for your kind reproduce with image, Frank.
However my issue is when I'm working with SSAS live connect, not just Power BI alone.
The same DAX expression works in Power BI, but when the data comes from SSAS tabular mode in Live connection, the expression makes error.
Looks weird.
I'm sorry I put wrong express in my post, I surely used correct expression that works in Power BI without SSAS.
like you corrected.
e.g. Measure = IF(MAX('Table'[TextColumn]) = "A", Value, Blank())
Therefore, the error is not from ")"
Thanks.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
42 | |
37 | |
22 | |
22 | |
21 |