Forum Discussion
MAX function with Text column doesn't work in Live Connection SSAS Tabular
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.
13 Replies
- AnonymousNot applicable
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
- AnonymousNot applicable
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.
- AnonymousNot applicable
Hi Anonymous ,
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())- AnonymousNot applicable
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.
- Greg_DecklerCommunity Champion
Perhaps LASTNONBLANK ?
That's good to know about the MAX function because I use it all the time with text columns.
- AnonymousNot applicable
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.
- Greg_DecklerCommunity ChampionNo, generally not with SSAS Tabular, just in Power BI Desktop against an imported data set. Although, that is supposed to be SSAS Tabular under the hood so ?
Very strange.
- adavbn3Frequent Visitor
did you ever find a solution to this? running into the exact problem now, and can't think of a way to workaround it