Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I would like to have a graph to calculate the top 2 languages with their percentage of the total for the table below:
User | Language |
A | English |
A | French |
B | English |
B | French |
B | French |
C | English |
D | English |
E | Spanish |
F | English |
The answer should look like the graph below. Please note that the answers should show the English and French with 55.56 and 33.33 percent respectively.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
I assume the table has a column (Index column or date column, for instance) to differenciate each row that is shown in the question.
Top two count percent: =
VAR _totalcount =
CALCULATE ( COUNTROWS ( Data ), REMOVEFILTERS () )
VAR _toptwocount =
CALCULATE (
COUNTROWS ( Data ),
KEEPFILTERS (
TOPN ( 2, ALL ( Data[Language] ), CALCULATE ( COUNTROWS ( Data ) ), DESC )
)
)
RETURN
DIVIDE ( _toptwocount, _totalcount )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
I assume the table has a column (Index column or date column, for instance) to differenciate each row that is shown in the question.
Top two count percent: =
VAR _totalcount =
CALCULATE ( COUNTROWS ( Data ), REMOVEFILTERS () )
VAR _toptwocount =
CALCULATE (
COUNTROWS ( Data ),
KEEPFILTERS (
TOPN ( 2, ALL ( Data[Language] ), CALCULATE ( COUNTROWS ( Data ) ), DESC )
)
)
RETURN
DIVIDE ( _toptwocount, _totalcount )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
52 | |
51 | |
20 | |
17 | |
16 |
User | Count |
---|---|
113 | |
46 | |
44 | |
28 | |
22 |