Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
When calculating the average sales per day, I have the following measure for NumOfDays:
NumOfDays = IF (
[Sales Amount] > 0;
COUNTROWS ( Date )
)What this is doing is removing the number of days for those dates when there are no sales.
Thus, I have the following visual:
As you can see, the total is wrong.
This is due to the fact that the database has more years than those shown in the matrix.
How can I define the granularity for "day" when calculating NumOfDays?
That is, how can I count the rows for those days with sales only?
Thanks!
![]()
Solved! Go to Solution.
Hi @webportal,
In your scenario, you can create a measure like below:
NumOfDays = CALCULATE(COUNTROWS('Adventure Works'),FILTER('Adventure Works',SUM('Adventure Works'[Internet Sales Amount])>0))
Best Regards,
Qiuyun Yu
Hi @webportal,
In your scenario, you can create a measure like below:
NumOfDays = CALCULATE(COUNTROWS('Adventure Works'),FILTER('Adventure Works',SUM('Adventure Works'[Internet Sales Amount])>0))
Best Regards,
Qiuyun Yu
Hi,
Sure, that one is working, thank you!
Also, this one:
NumOfDays2 =
CALCULATE (
DISTINCTCOUNT ( 'Date'[Date] );
FILTER ( 'Date'; Sales[Sales Amount] > 0 )
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |