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.
I have a data set of inspections and was able to create a Top 20 measure to include the Top 20 and lump the remainder into an "Other" category.
My issues is I sort the data and the "Other" category needs to sort at the end of the chart. I need highest to lowest except the Other category needs to be at the end.
Top 20:
top 20 and other =
var top20 = CALCULATETABLE(TOPN(20,VALUES(Inspections[Issue]),CALCULATE(SUM(Inspections[# Found]))))
var other = ROW("Issue", "Other")
var allTheRest = CALCULATE(SUM(Inspections[# Found]), EXCEPT(VALUES(Inspections[Issue]),top20))
var theUnion = UNION(top20,other)
return
SUMX(
INTERSECT('Issue List',theUnion),
var currentIterator = 'Issue List'[Issue]
return
IF(
'Issue List'[Issue] <> "Other"
,CALCULATE(
SUM(Inspections[# Found])
,Inspections[Issue] = currentIterator
)
,allTheRest
)
)
@Anonymous,
You can use RANKX function to rank your category, for more details, please review the following similar blog.
https://kohera.be/blog/power-bi/power-bi-ranking-group/
Alternatively, you can create measures following the guide in this blog. If you have question about the DAX, please share sample data of your table here.
Regards,
Lydia
Sorry for the delay in my response. I am swamped with work. Ugh.
It is very similar to your blog. I downloaded your pbix file and played with it but it does not quite work for what I need. I need to display the results in a bar chart. When I change your table in the sample data to a bar chart it does not work the same. You lose the "Others". It does not let me use the Measure Country in the Axis for the bar chart.
@Anonymous,
Could you please share sample data of your table here? I will test it in my Desktop.
Regards,
Lydia
I am not sure how to share a file here so I have to show a picture.
@Anonymous,
You can upload the file to OneDrive and post shared link of the file here.
Regards,
Lydia
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |