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.
Hi, I need some help in coding the DAX. I came across this website https://blog.enterprisedna.co/showcase-the-top-result-name-within-a-card-visualization-using-power-b...and I tried to follow the coding for my case. But it does not work in my case.
I am sharing the sample data and coding here.
Program Table
If I click on FY 20, it should reflect the top program attended by participants. In my case, it shows blank value.
Not sure whether I have coded in a wrong way.
Solved! Go to Solution.
@Anonymous
Ok, then you just need TOPN(1,... instead of TOPN( 2,...
Top Prog =
CONCATENATEX (
TOPN (
1,
DISTINCT ( Program[Programme Name] ),
[Total no of program attendees], DESC
),
Program[Programme Name],
", "
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
@Anonymous
Ok, then you just need TOPN(1,... instead of TOPN( 2,...
Top Prog =
CONCATENATEX (
TOPN (
1,
DISTINCT ( Program[Programme Name] ),
[Total no of program attendees], DESC
),
Program[Programme Name],
", "
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Anonymous
Try this:
Top 2 Prog =
CONCATENATEX (
TOPN (
2,
DISTINCT ( Program[Programme Name] ),
[Total no of program attendees], DESC
),
Program[Programme Name],
", "
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
THanks it works! But as for the case where there is only 1 program with the highest no of attendees, I just would need only 1 program name that will be displayed. If there are any other 2 programs with the same highest no of attendees, then I will need 2 programs to be displayed.
Currently, based on your solution, I have 2 different program names with different no of attendees. But I would want only 1 program name if there is no other program with the same highest no of attendees.
Case 1:
Program A: 100 people
Program B: 90 people
Then the card should show "Program A"
Case 2
Progam A: 100 people
Program B: 100 people
Then the card should show " Program A, Program B"
Thanks!
@Anonymous ,
Try like example
Top 1Rank = CALCULATE(max(Program[Program Name]),TOPN(1 ,all(Program[Program Name]),[Sales],DESC),VALUES(Program[Program Name]))
https://www.youtube.com/watch?v=QIVEFp-QiOk
Thanks! It works. However in one of the FYs, I have more than 1 result that shows the highest no. How to display more than 1 result at the same time in the Card visualisation?
For example
"Program 1 & Program 2"
Most popular courses
@Anonymous , Try like
Top 2 Rank = CALCULATE(concatenatex(Program,Program[Program Name]),TOPN(2 ,all(Program[Program Name]),[Sales],DESC),VALUES(Program[Program Name]))
It works but the outcome is not quite right.
When I select one FY, it shows that type of program name more than once. Even if there are two different programs that have the same highest no of attendees, it does not give me two different program names.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |