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 basic table about car repair :
Car ID | RepairPerformed | RepairDate |
1 | 1 | Nov. 8th |
2 | 1 | Oct. 21st |
3 | 0 | |
4 | 1 | Nov. 24th |
5 | 1 | Dec. 1st |
(real table is a bit more complex than that with 100k repairs and one more column with the ID of the repair performed)
Car ID is a unique vehicle ID
RepairPerformed is 0 if the repair is not performed to date, 1 if it is
RepairDate is nothing if the repair is not performed to date, the repair date if it is
First step, I want the % of repair performed
Easy : create a custom measure : %repair = sum(RepairPerformed) / count (Car ID)
Now I want to be able to go back in time
Today, 80% cars are repaired
But at November 30th it was 60% (3 out of 5)
At November 15th it was 40% (2 out of 5)
I tried to use a slicer on repair date, but it does not work.
If I slice repair date from 01st January to November 15th, % repair become 75% (car n° 4 is removed from the data, so 3 cars out of 4 repaired => 75%)
I don't have a clue on how to get to the real result.
Solved! Go to Solution.
So the issue is that the date slicer is also filtering the count of cars. So you could do something like the following:
%repair = sum([RepairPerformed]) / CALCULATE( count ( [Car ID]), ALL( Repairs[RepairDate]) )
But I can still see some issues. This assumes a car only has one repair and to truely go "back in time" you would need to know when the car was booked in for repair so you did not count cars for historic dates that had not yet come in for repair.
Thanks for the help, I will try this ASAP
The "real" database is build with one line for each repair/car with a repair ID unique for each repair/vehicle (the same ID can be used for multiple car but will be used only once per vehicle).
I will add a column with car ID and repair AD concatenated together so I have a unique repar/car ID. Then I will use this ID for counting in the formula you gave me.
Regarding booking issue : as long as a car is only booked RepairPerformed is 0 and RepairDate is empty. So they are easy to detect
Edit : solution tested and it work great, thanks
So the issue is that the date slicer is also filtering the count of cars. So you could do something like the following:
%repair = sum([RepairPerformed]) / CALCULATE( count ( [Car ID]), ALL( Repairs[RepairDate]) )
But I can still see some issues. This assumes a car only has one repair and to truely go "back in time" you would need to know when the car was booked in for repair so you did not count cars for historic dates that had not yet come in for repair.
Does someone have an hint on how to solve my problem ? I'm still stuck
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 |