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.
So I have a formula like so
SUM DAYS = SUM(Data1[Number of weekdays])+SUM(Data2[Number of weekdays]) How do i exclude 0's in this caclulation
To make the following give a more accurate result
AVG = [SUM WEEKDAYS}/[COUNT OF RECORDS}
Solved! Go to Solution.
Hi @Jay2022 ,
I create two tables as you mentioned.
Then I create two measures and here are the DAX codes.
NonullDate1 =
IF (
MAX ( 'Table1'[End Date] ) = BLANK (),
0,
MAX ( 'Table1'[Number of weekdays] )
)
NonullDate2 =
IF (
MAX ( 'Table2'[End Date] ) = BLANK (),
0,
MAX ( 'Table2'[Number of weekdays] )
)
Next you can create a new measure.
Measure = SUMX('Table1','Table1'[NonullDate1]) + SUMX('Table2','Table2'[NonullDate2])
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you I think the problem is i'm actually counting the records based on an id but some of the weekdays that are being counted are 0 due to an end date column (of the spreadsheet) not yet being input. It's a tricky one.
Hi @Jay2022 ,
I create two tables as you mentioned.
Then I create two measures and here are the DAX codes.
NonullDate1 =
IF (
MAX ( 'Table1'[End Date] ) = BLANK (),
0,
MAX ( 'Table1'[Number of weekdays] )
)
NonullDate2 =
IF (
MAX ( 'Table2'[End Date] ) = BLANK (),
0,
MAX ( 'Table2'[Number of weekdays] )
)
Next you can create a new measure.
Measure = SUMX('Table1','Table1'[NonullDate1]) + SUMX('Table2','Table2'[NonullDate2])
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Jay2022 Well, if you are summing, then you are ignoring 0's. The problem then I assume is with your count of records measure which should be something like:
COUNT OF RECORDS =
COUNTROWS( FILTER( 'Data1', [Number of weekdays] <> 0 ) ) + COUNTROWS( FILTER( 'Data2', [Number of weekdays] <> 0 ) )
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |