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 really need help in writing a measure. I have attched sample PBI Table and screen shot of current table. I use a Filter for the Reporting Location City and a Measure that shows the Top 5 Reporting Location Cities by a Count and then Sum. That part works great. I have been trying to get help but not getting results on my own. Is this really not as simple as it seems.
Now I need someone to write a measure that I could add to the filter that would keep the Cause Grouping under each City to the Top 5 by Frequency. If a tie, then first look at top Frequency and then use the Incurred to break the tie to keep only 5.
From image below , for example, under Kansas City there are three 3's which leaves 6 total causes The tied 3's are Assault, Exposure and NC.
The measure if working, would keep
Cut, Puncture 19
Burn, Scald 5
STF 5
NC 3
Assault 3
San Antonio would keep
Cut, Puncture 12
STF 10
Caught Between 2
Assault 2
Burn, Scald 2
Solved! Go to Solution.
Have you tried sorting by the sum measure in descending order?
Proud to be a Super User!
Paul on Linkedin.
I would go for:
Ref =
[Sum of Total Gross Incurred] * 1000000000000 + COUNT(LossRunToExcel[Reporting Location City])
Proud to be a Super User!
Paul on Linkedin.
I got the first example to work in main file. Thank you for all the help. I will need more time this weekend to try the more creative and visual 2nd option.
Yes, it's definitely an issue in the service. You need to sort by the city field to get the axis to respect the structure:
It actually emulates the problem we used to have in Desktop when you turned off concatenate fields: for the setting to take effect, you needed to sort the axis by the fields:
It might be worth reporting the issue on the issues forum:
https://community.powerbi.com/t5/Issues/idb-p/Issues
Proud to be a Super User!
Paul on Linkedin.
You are correct, I had to turn Concatenate off for the X-Axis and then sort by the Sort Measure to ge the Desktop file to look right. Unfortunately it loses that when published. I will report.
Paul, here is a screen shot of an account after publishing that has less then 5 locations. Why no line or division between Cities?
It looks like you have lost the option of not concatenating the fields (same issue as we discussed previously)
Proud to be a Super User!
Paul on Linkedin.
I did report the issue and gave several screen shots of differnces between Desktop and Publishing of Clustered Column Chart with Concatenate Off.
I tried stacked column chart and same bad results
I got the first example to work in main file. Thank you for all the help. I will need more time this weekend to try the more creative and visual 2nd option.
Did my post with 2 examples of the clustered column chart disappear?
Proud to be a Super User!
Paul on Linkedin.
Now whats funny it that the Table gets different cities than the visual in my main file. I may need to take your new visual measures and apply them to the table.
See table and chart. Shiloh is wrong on table and Frisco is right on Visual. Frisco is 28 and Shlioh is 27 I mentioned there was an issue with the table yesterday for some accounts.
Ok now I think I am good. I applied fhe new Sum Measure from chart to table.
Here is what Chart look like when published?
Not sure why it looks good before publihing and not after? Why is it doing that?
How would we remove the City Name from the Axis and still keep sorting by City and Cause Grouping for it to publish right?
Paul, how would you tweak the following you provided to make page where Sum is used first and Count is as Tie breaker. I tried to replace Count with Sum for all and got close.
I believe I got it work. I had to recheck all.
If you remove the city field, the measures loose the field context, so the visual will display aggredate values for case grouping
Proud to be a Super User!
Paul on Linkedin.
Great!
"How could I apply the Sort Measure to the Clustered Column Chart to mirror the Matrix Table?"
Add the [Sort measure] as a tooltip to the visual and then sort the x-axis by the measure in descending order.
Proud to be a Super User!
Paul on Linkedin.
Oh, right!! I see what you mean! My mistake. The sorting measure is by incurred only; it ignores frequency!
We need to do the same calculation of frequency * PWR(10, n) + the CALCULATE() in the second RANKX of the sorting measure. I'll sort it out when I'm back at work tomorrow
Proud to be a Super User!
Paul on Linkedin.
Playing around with the different Dax, but now I can not seem to show the TOP Cause Grouping in Descending Count and Sum in the right order. 5 selected for Count are correct but Sum is not in Descending order when counts are equal.
.
You just need to sort the matrix by the [Incurred] measure in descending order. The [Top 5 by frequency and incurred] measure is only relevant to filter the matrix for the top 5. Once it's filtered, just sort by the [Incurred] measure
Proud to be a Super User!
Paul on Linkedin.
Juts perhaps for the sake of practicing DAX, a more elegant way to calculate meausre [Ref] would be to calculate an appropiate factor instead of the random 1000000000000.
So:
Ref =
VAR _MX =
MAXX (
ALL ( InjuryCause[Cause Grouping] ),
CALCULATE ( COUNT ( LossRunToExcel[Total Gross Incurred] ) )
)
VAR _LNGTh =
LEN ( _MX ) + 1
RETURN
COUNT ( LossRunToExcel[Reporting Location City] ) * POWER ( 10, _LNGTH ) + [Sum of Total Gross Incurred]
Proud to be a Super User!
Paul on Linkedin.
Paul,
I tried your latest Ref as a way to pratice DAX, but it did not select the correct Top 5.
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 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |