Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 🙂
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 10 | |
| 7 | |
| 5 |