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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
deepakv
Frequent Visitor

Based on 2 measures can the calculation work or return null?

Hi Community,

With the below table 

If any of the measure (Cost) and measure(Prior quarter values) contains nulls the Variance column should not perform the calculation, If both the measures contains values then the variance should pop up with correct totals as I am observing the wrong sum of total for each measure.

For totals to be correct i have used-

SUMX(GROUPBY(TABLE,TABLE[PRODUCT]),CALCULATE( [Prior quarter]-[Cost]))
 
Any help would be helpful.

 

Product Costprior quarter valuesVariance (C-B)
A100009000-1000
B200000-20000
D050005000
E100007000-3000
C300000-30000
G01500015000
D1500014000-1000
C300000-30000
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@deepakv ,

variance = if(not(isblank([COst])) && not(isblank([prior quarter values]))  , [prior quarter values] -[Cost], blank())

 

or

 

variance =Sumx(values(Table[Product]), calculate(  if(not(isblank([COst])) && not(isblank([prior quarter values]))  , [prior quarter values] -[Cost], blank()))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
deepakv
Frequent Visitor

Thank you it worked @amitchandak 

amitchandak
Super User
Super User

@deepakv ,

variance = if(not(isblank([COst])) && not(isblank([prior quarter values]))  , [prior quarter values] -[Cost], blank())

 

or

 

variance =Sumx(values(Table[Product]), calculate(  if(not(isblank([COst])) && not(isblank([prior quarter values]))  , [prior quarter values] -[Cost], blank()))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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