Forum Discussion
Shawn3001
5 years agoFrequent Visitor
Creating a Measure To Return Summarized Values Based on Report Parameters/Slicers
Hello, I'm working with a large data set of manufacturing asset downtime and I'm trying to filter the display of a report table based on the values of a couple of report-level parameters. Pictur...
littlemojopuppy
5 years agoCommunity Champion
Here's the code for all the measures I created...
Delay Count = DISTINCTCOUNT(Delays[ID])
Total Delay (Hours) =
SUMX(
Delays,
DATEDIFF(
[Delay Start],
[Delay End],
HOUR
)
)
Severity =
VAR DelayCount = [Delay Count]
VAR DelayDuration = [Total Delay (Hours)]
RETURN
SWITCH(
TRUE(),
AND(
DelayCount > 'Delay Count'[Delay Count Value],
DelayDuration > 'Delay Duration'[Delay Duration Value]
),
"Catastrophic",
AND(
DelayCount > 'Delay Count'[Delay Count Value],
DelayDuration > 'Delay Duration'[Delay Duration Value]
),
"Severe",
"Normal"
)[Delay Count] is just the distinct count of Delay ID. [Delay Count Value] and [Delay Duration Value] are the what if parameters that the user could set. You could drop Description into the rows for a matrix and [Delay Count] and {Total Delay (Hours)] in as values and they would calculate based on the filter context.