The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I would like to count the number of stores with YTD YOY sales <0. I have created the following measure but the result is not correct. Can you help me correct it please. As a reference date, I entered the date of 04 09 2022 in the filters.
Number of Store in L = calculate(DISTINCTCOUNT('Table Sales'[Store Key]), FILTER('Table Sales',[Sales Net Amount YTD YoY] < 0))
Store | Sales Net Amount YTD | Sales Net Amount Y-1 YTD | Sales Net Amount YTD YoY | Count Store in Lose |
A | € 1.110 | € 1.037 | € 73 | 1 |
B | € 1.998 | € 1.976 | € 22 | |
C | € 656 | € 671 | -€ 15 | |
D | € 799 | € 795 | € 4 | |
E | € 523 | € 518 | € 6 | |
F | € 488 | € 457 | € 30 | |
G | € 714 | € 827 | -€ 113 | |
H | € 292 | € 262 | € 30 | |
I | € 478 | € 442 | € 37 |
Solved! Go to Solution.
Hi @Morrison ,
the issue is with your Filter statement. Instead of iterating over Sales, it should be iterating over distinct values of Store key.
Maybe you can try this version instead?
Number of Store in L =
COUNTROWS(
FILTER(
VALUES('Table Sales'[Store Key]),
[Sales Net Amount YTD YoY] < 0
)
)
Hi @Morrison ,
the issue is with your Filter statement. Instead of iterating over Sales, it should be iterating over distinct values of Store key.
Maybe you can try this version instead?
Number of Store in L =
COUNTROWS(
FILTER(
VALUES('Table Sales'[Store Key]),
[Sales Net Amount YTD YoY] < 0
)
)
Hi m3tr01d,
thx for the solution 🙂
User | Count |
---|---|
26 | |
10 | |
8 | |
5 | |
5 |
User | Count |
---|---|
33 | |
13 | |
11 | |
9 | |
8 |