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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rssilvaba
Resolver II
Resolver II

Top n results where n is based on a measure or expression

Hi all, the following file has some sample data and in the table visual I am trying to display all the topn Urgent Items based on the "Total Number of Urgent requests"-"Goal" rounded up.

In the case of the current view in the sample that would be top 3 ordered from newest to oldest created date.

https://drive.google.com/file/d/1WFBlvVHV7cS4F519BP-UphHRPhNi4gtb/view?usp=sharing

1 ACCEPTED SOLUTION

Hi @rssilvaba ,

You can try this measure:

Goal = 
VAR top3 =
    COUNTX (
        TOPN ( 3, ALLSELECTED ( Requests[Created] ), 'Requests'[Created], DESC ),
        'Requests'[Created]
    )
RETURN
    top3 / [Total Number Urgent Requests]

topn.png

Attached the modified sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@rssilvaba - Adding that measure to the visual returns 1 for every row. Where is "Goal"?


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler "Goal" is the KPI Target Urgent Requests

Hi @rssilvaba ,

You can try this measure:

Goal = 
VAR top3 =
    COUNTX (
        TOPN ( 3, ALLSELECTED ( Requests[Created] ), 'Requests'[Created], DESC ),
        'Requests'[Created]
    )
RETURN
    top3 / [Total Number Urgent Requests]

topn.png

Attached the modified sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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