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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wangjuan303
Helper III
Helper III

IF (True/False, TopN1, TopN2) get error message

I need get Top N value from Slicer, but some slicer value is +, some slicer is -,  when slicer is +, I will choose TopN, when slicer is -, I will choose bottom N, here is my DAX : 

TopN = 

var TopProductDesc = TOPN(25, ALLSELECTED('Ultimate'[Credit Ultimate]), [DateSale], DESC)

var TopProductAsc   = TOPN(25, ALLSELECTED('Ultimate'[Credit Ultimate]), [DateSale], ASC)

var AscorDesc = SELECTEDVALUE('Measure'[Measure]) IN {"A","B","C","D"}

var TopProduct = IF ( AscorDesc , TopProductDesc, TopProductAsc)

RETURN

TopProduct

 

error message is :

The True/False expression does not specify a column, Each True/False expression used as a table filter expression must refer to exactly one column.

 

If I want according measure decide TopN desc or TopN asc, How to modify my DAX, Thank you for help

1 REPLY 1
AlexisOlson
Super User
Super User

It looks like you're trying to create a calculated table. However, calculated tables cannot be responsive to slicers since they are only calculated once per time the data model is loaded, not in response to filtering in the report.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.