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 everyone,
I have a list of items that I did count for late delivery and on time delivery. It means the item could be in both category Late and On-time. By doing the count for each category, I realized the total was over calculated. For example, I counted Item A has 1 "late", 2 "on-time", but would be considered "late" in overall.
How could I add this filter condition while counting on-time for not including this item?
Solved! Go to Solution.
Hi @rdnguyen ,
Based on your description, I have created a simple sample:
Please try:
Late =
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="Late"),[Flag])
On-Time =
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="On-Time"),[Flag])
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rdnguyen ,
Based on your description, I have created a simple sample:
Please try:
Late =
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="Late"),[Flag])
On-Time =
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="On-Time"),[Flag])
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rdnguyen
you need to iterate over "items" like
SUMX (
VALUES ( 'Table'[Item Name] ),
[Count Measure]
)
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |