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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

DAX to Hide Variance number if current year data is Missing

ESDC_0-1608165321227.png

Hello,

The table on the left shows Crrrent year and Previous Year Data. THe table on the right shows the Variance between the two fiscal years. From Period 9 to 12 I have to Current Year Data. How can I make my varaince blank for those periods? I tried the DAX formula below but it does not work. 

 

Variance2 = 
VAR CY = [Current Year]
VAR PY = [Previous Year]
VAR VarianceT = CY-PY
VAR RESULT = IF (ISBLANK (CY),0,(VarianceT))
RETURN Result

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Nevermind! I seem to have overcomplicated my DAX formulas. This fixes everything, and now my visual excludes periods which cannot be compared! 

 

Current.YearT = [Amount]
Previous.YearT = (CALCULATE([Amount], SAMEPERIODLASTYEAR('Calendar'[Date])))
Variance2 = if(isblank([Current.YearT]),blank(),[Current.YearT]-[Previous.YearT])
Variance.T% = Divide([Variance2],[Current.YearT])

ESDC_0-1608225417515.png

 

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Make 0 as blank and try

 

Variance2 =
VAR CY = [Current Year]
VAR PY = [Previous Year]
VAR VarianceT = CY-PY
RETURN IF (ISBLANK (CY),blank(),(VarianceT))

 

You can do this for PY measure too, if you want hide the rows. You have do it for all the measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

My Current Year and Previous Year are written this way.  

Current Year = if(ISBLANK([Amount]),"$0",([Amount]))//Same as Amount

Previous Year = IF(ISBLANK(CALCULATE([Amount], SAMEPERIODLASTYEAR('Calendar'[Date]))),"$0",CALCULATE([Amount], SAMEPERIODLASTYEAR('Calendar'[Date])))

 

Anonymous
Not applicable

Nevermind! I seem to have overcomplicated my DAX formulas. This fixes everything, and now my visual excludes periods which cannot be compared! 

 

Current.YearT = [Amount]
Previous.YearT = (CALCULATE([Amount], SAMEPERIODLASTYEAR('Calendar'[Date])))
Variance2 = if(isblank([Current.YearT]),blank(),[Current.YearT]-[Previous.YearT])
Variance.T% = Divide([Variance2],[Current.YearT])

ESDC_0-1608225417515.png

 

 

Ashish_Mathur
Super User
Super User

Hi,

Since CY is a measure, it should be between [].  So try this

=if(isblank([CY]),blank(),[CY]-[PY])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Unfortunately it di not work. My negative variances caused by No periods in 2020-2021 are still appearing

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors