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
SteveIOW
Helper II
Helper II

TOPN doesn't work as a filter

Good morning.

 

I have used 

WorstModTrend = TOPN ( 1 , VALUES ( Modalities[Modality] ), CALCULATE([Avg Rise (M)]) , DESC )
to identify the modality with the worst trend.
I now want to identify what that trend is. Obviously I have a table - but in terms of picking it out I need it to appear in a card.
SteveIOW_0-1655893052577.png

 

Non-obstetric unltrasound is produced with no difficulty by the DAX I stated above.

I have tried

WorstTrend = CALCULATE([Avg Rise (M)], Modalities[Modality] = [WorstModTrend])
and it does not work at all.
I have also tried
WorstTrend = CALCULATE([Avg Rise (M)], FILTER(Modalities, [Modality] = [WorstModTrend]))
which just gives me the total trend  (29,943) - not the worst (greatest) trend which is what I need.
 
Is anyone able to help please?
 
Cheers
 
Steve
1 ACCEPTED SOLUTION

Think I have done it myself - by taking a completely different approach.

 

WorstTrend = MAXX(SUMMARIZE(Modalities, Modalities[Modality], "Rise", LinearRegTable[Avg Rise (M)]), LinearRegTable[Avg Rise (M)])
 
I'm sure there is a better way although this gives the right answer. If anyone can give me the another way I will be interested.
 
Cheers

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@SteveIOW , You should try like

 

WorstTrend = CALCULATE([Avg Rise (M)], Modalities[Modality] , TOPN ( 1 , VALUES ( Modalities[Modality] ), CALCULATE([Avg Rise (M)]) , DESC ))

 

do you need bottom means asc

 

WorstTrend = CALCULATE([Avg Rise (M)], Modalities[Modality] , TOPN ( 1 , VALUES ( Modalities[Modality] ), CALCULATE([Avg Rise (M)]) , asc))

 

refer

https://youtu.be/QIVEFp-QiOk

Think I have done it myself - by taking a completely different approach.

 

WorstTrend = MAXX(SUMMARIZE(Modalities, Modalities[Modality], "Rise", LinearRegTable[Avg Rise (M)]), LinearRegTable[Avg Rise (M)])
 
I'm sure there is a better way although this gives the right answer. If anyone can give me the another way I will be interested.
 
Cheers

@amitchandak thanks for having a look at this for me.

 

I have tried as you have written but of course it does not provide a boolean output so it fails. I tried putting in an = instead of a comma but that also fails as below.

 

SteveIOW_0-1655900449376.png

 

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.