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 all,
I am fairly new to DAX and am a bit stuck on something, I have tried googling/lurking for a solution to no avail.
I'm trying to calculate the delay rate of delivery trucks. I have a table with one row for each delivery, it also includes a column with the delay code. The measure "Delay Rate %" is being used as the values for a column chart with a month axis.
It works perfectly when I specify the reason in the measure (example):
Delay Rate % = CALCULATE(SUM(Data[Delivery Complete),Data[Delay Reason]="WEATHER")/SUM(Data[Delivery Complete])
However, I would like the user to be able to select the delay reason from a slicer. (e.g. weather, fuel, customer, traffic, etc)
What would be the easiest way to do this? (if at all possible) Thank you for your help in advance.
Solved! Go to Solution.
Get rid of the calculate all together and just keep the division. Add a slicer on your delay reason column, and it will work (after you add the extra calculate below). Calculate is a hard coded way to apply a filter. A slicer is another way to apply a filter, but it is user selectable
you will need to add a new calculate to the denominator so it ignores the slicer.
Denominator should be
calculate(sum(data[delivery complete]),all(data[delay reason]))
Get rid of the calculate all together and just keep the division. Add a slicer on your delay reason column, and it will work (after you add the extra calculate below). Calculate is a hard coded way to apply a filter. A slicer is another way to apply a filter, but it is user selectable
you will need to add a new calculate to the denominator so it ignores the slicer.
Denominator should be
calculate(sum(data[delivery complete]),all(data[delay reason]))
Thank you very much for the prompt reply, Matt! It worked perfectly.
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 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |