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.
Hello everyone, please help me out with TopN Function, I am struggling for so long on measure function.
I tried some solution from here but still not get result that I want.
I want to make 2 chart of top 5 value for selected year and last year of selected year
Example : I select 2022 on my slicer date and i want to make 2 top N chart from this current table
Name | Year | Value |
A | 2022 | 1,000,000 |
B | 2022 | 900,000 |
C | 2022 | 800,000 |
D | 2022 | 700,000 |
E | 2022 | 600,000 |
F | 2022 | 500,000 |
G | 2022 | 400,000 |
H | 2022 | 300,000 |
I | 2022 | 200,000 |
J | 2022 | 100,000 |
K | 2022 | 50,000 |
L | 2022 | 25,000 |
A | 2021 | 800,000 |
B | 2021 | 600,000 |
C | 2021 | 50,000 |
D | 2021 | 25,000 |
E | 2021 | 750,000 |
F | 2021 | 625,000 |
G | 2021 | 1,000,000 |
H | 2021 | 950,000 |
I | 2021 | 10,000 |
J | 2021 | 0 |
K | 2021 | 500,000 |
L | 2021 | 550,000 |
become 2 chart like this
I want to make it on measure formula because if I select on 2020 then i want my last year chart to automatically showing 2019.
Thanks for your attention and appreciate any helps.
Solved! Go to Solution.
Hi @tevisyauw ,
Here I create a sample to have a test.
Data Model:
Measures:
Select Year Value =
VAR _SELECTYEAR = SELECTEDVALUE(DimYear[Year])
RETURN
CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = _SELECTYEAR))
Previous Year Value =
VAR _SELECTYEAR = SELECTEDVALUE(DimYear[Year])
RETURN
CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = _SELECTYEAR - 1))
Select Visual Name = "Value" &" "& SELECTEDVALUE(DimYear[Year])
Pervious Visual Name = "Value" &" "& SELECTEDVALUE(DimYear[Year])-1
Add measures in TopN filter for [Name] column.
Add visual name measure into Title fx.
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @tevisyauw ,
Here I create a sample to have a test.
Data Model:
Measures:
Select Year Value =
VAR _SELECTYEAR = SELECTEDVALUE(DimYear[Year])
RETURN
CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = _SELECTYEAR))
Previous Year Value =
VAR _SELECTYEAR = SELECTEDVALUE(DimYear[Year])
RETURN
CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = _SELECTYEAR - 1))
Select Visual Name = "Value" &" "& SELECTEDVALUE(DimYear[Year])
Pervious Visual Name = "Value" &" "& SELECTEDVALUE(DimYear[Year])-1
Add measures in TopN filter for [Name] column.
Add visual name measure into Title fx.
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much, you are lifesaver @v-rzhou-msft just in time before my deadline.
need any help. appreciate it.
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 |
---|---|
107 | |
99 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |