March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have the following data which has 17 different workorders but only 5 different system description class 1/downtime start/downtime end combinations. They each have a Downtime Day of 1.
I have numerous other rows that are have downtime days for the same class 1 and are unique values.
How do I write DAX to sum downtime days for all unique rows, but for the values that are not unique only take the datediff between downtime start and downtime end once?
So for the above, if I rollup to ALARM only, it would show Downtime Days = 5? It currently shows 17 since it is summing each row.
Solved! Go to Solution.
Hi @KMcCarthy9 ,
Based on my testing, please try the following methods again:
1.Create the simple table.
2.Create the new column to combine.
Unique combine =
CONCATENATE(
CONCATENATE([System Description Class 1], CONCATENATE("_", [Downtime Start])),
CONCATENATE("-", [Downtime End])
)
3.Create the new measure to calculate the days.
Unique days =
SUMX(
VALUES('Table'[Unique combine]),
CALCULATE(
MAX('Table'[Downtime Days]),
ALLEXCEPT('Table', 'Table'[Unique combine])
)
)
4.Drag the measure into the table visual. The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @KMcCarthy9 ,
Based on my testing, please try the following methods:
1.Create the simple table.
2.Create the new column to combine.
Downtime Combinations =
CONCATENATE(
CONCATENATE([System Description Class 1], CONCATENATE("_", [Downtime Start])),
CONCATENATE("-", [Downtime End])
)
3.Create the new measure to calculate the days.
Unique Downtime Days = SUMX(DISTINCT('Table'[Downtime Combinations]), 1)
4.Drag the measure into the card visual. The result is shown below.
You can also view the following link to learn more information.
Solved: Dax for sum of distinct values - Microsoft Fabric Community
Solved: Sum of values based on distinct values in other co... - Microsoft Fabric Community
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-jiewu-msft Thank you for your answer, but this doesn't quite get what I need.
This is giving me the distinct count of the class/downtime rows, however this would only work if the downtime days = 1. What about rows that the downtime days = 2, 3, 4, etc? If each example above was 2 days, I would need the final Downtime Days = 10.
Also, I am looking for 1 DAX solution that will sum the dwntime days for all unique combinations, but only sum the non-unique combinations once.
For example, if there is 1 row under ALARM that reads CLEANER, downtime from 1/8/24 - 1/11/24, I would want the results to show:
ALARM = 5
CLEANER = 3
I will check out the links you provided.
Hi @KMcCarthy9 ,
Based on my testing, please try the following methods again:
1.Create the simple table.
2.Create the new column to combine.
Unique combine =
CONCATENATE(
CONCATENATE([System Description Class 1], CONCATENATE("_", [Downtime Start])),
CONCATENATE("-", [Downtime End])
)
3.Create the new measure to calculate the days.
Unique days =
SUMX(
VALUES('Table'[Unique combine]),
CALCULATE(
MAX('Table'[Downtime Days]),
ALLEXCEPT('Table', 'Table'[Unique combine])
)
)
4.Drag the measure into the table visual. The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
128 | |
90 | |
75 | |
56 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |