Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

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.

CategoryDateValue
A2019-01-03100
B2019-01-0380
C2020-01-03140
A2020-01-04570
B2020-01-04130
C2020-01-04330

 

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 13
adavbn3
Frequent 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

Greg_Deckler
Community Champion
Community Champion

Perhaps LASTNONBLANK ?

 

That's good to know about the MAX function because I use it all the time with text columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not 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.

No, 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.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yes, It is very strange.

I cannot figure out any clue at all that can make different work.

Anonymous
Not applicable

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
Not applicable

If you are sure that in the context there'll be only one value anyway... why not use SELECTEDVALUE?

Best
D
Anonymous
Not applicable

@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...

 

 

 

Anonymous
Not applicable

Whether you can use this function or not depends on the version of the product you use. Please find the documentation and examples of usage here:

https://dax.guide/selectedvalue/

Best
D
Anonymous
Not 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

Anonymous
Not 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?

 

2.PNG

 

Or we can try this formula.

IF(value('Table'[TextColumn]) = "A", Value, Blank())

 

 

Anonymous
Not 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.

 

Anonymous
Not 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.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.