Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Don't sum/calculate in measures when adjacent column is blank

Hello,

 

So I have an issue where a target field is populated before the sales data arrives at the start of the month.  This is skewing my results.  In a table this isn't too much of a problem because you can just filter out the row using 'is not blank' tick box and it will re-calculate the data.

 

Sales MTDBudget MTDVarianceVariance%
7090-20-22.2
5070-20-28.6
2560-35-58.3
 55-55-100.0
145275-130-47.27

 

My question is about the measures which I drop into cards.  How do you stop it counting the blank rows?  If the Sales MTD column/row is blank, I don't want it to add in values from the budget or variance columns into my measures either.  This is my DAX:

 

Sales MTD: 

CALCULATE(TOTALMTD([SQLSales],DateDimension[Date]),DateDimension[Date]<=TODAY())
 
Budget MTD: 
[Target MTD]*(DIVIDE([Workdays Passed CM],[Work Days CM],0))
 
Variance%MTD =
VAR __BASELINE_VALUE = [Budget MTD Calc]
VAR __VALUE_TO_COMPARE = [SQLSalesMTD]
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),
        DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
    )
 
VarianceSQLMTD = ([SQLSalesMTD]-[Budget MTD Calc])

 

Any ideas would be really welcome.  Thank you.

 

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

Can you please share some sample data for test?

How to Get Your Question Answered Quickly
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.