Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Forum,
I am here again to ask help,
Now i have a table with columns like below:
PartNo | Step | Status |
AAA | Step1 | In time |
AAA | Step1 | Delay |
AAA | Step2 | Completed |
BBB | Step1 | In time |
BBB | Step1 | Completed |
And i want to count the number of "Delay" and "In time" per PartNo and per Step. But the difficuly is i want: if status for the same PartNo and the same Step contain "Delay", then just count "1" for Delay, and if status for the same PartNo and the same Step contain "Completed" or "In time", then count "1" for In time.
For example, for the table i have here, the result of count will be:
PartNo | Step | Count_Delay | Count_InTime |
AAA | Step1 | 1 | |
AAA | Step2 | 1 | |
BBB | Step1 | 1 | |
I try to use the Measure solution below, but it doesn't work well. And i don't understand why.
I create a measure to return one Status per part
StatusPerPart =
var calc=CALCULATE(DISTINCTCOUNT('Table 2'[PartNo]);
filter('Table 2';
'Table 2'[Status]="Delay"))
Return
If(calc=1;"Delay";"In time")
After, i create a new measure to count the Status,
Count_InTime = countrows(filter(Table 2;Table 2[StatusPerPart]="In time"))
Count_Delay = countrows(filter(Table 2;Table 2[StatusPerPart]="Delay"))
Thank you!
[# In Time] =
CALCULATE(
COUNTROWS( T ),
KEEPFILTERS( T[Status] = "in time" )
)
[# Delay] =
CALCULATE(
COUNTROWS( T ),
KEEPFILTERS( T[Status] = "delay" )
)
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |