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
getsmithed
Frequent Visitor

Variance between Two Years on same Date Axis using same Amount Column

getsmithed_2-1747159419947.png

Unfiltered:

getsmithed_1-1747159354480.png

Filtered:

getsmithed_0-1747160105071.png

 

The task at hand is simple, take the 2025 values (Food Revenue, Beverage Revenue, etc.) and subtract the 2024 values from the correlated field (first screenshot). However, I am running into issues with the date axis it lies on and how to correctly display only the months needed. The formula used takes the sum of the current year (CY, Dec 2024 - Mar 2025) for a specific account, and subtracts it from the balance of the prior year (LY, Dec 2023 - Mar 2024). This does in fact work, as the values shown in the second screenshot are correct for Food Revenue Variance for the months needed thus far (fiscal year starts in December, so December 2024 - March 2025). However, when I filter to just show the months needed, the values revert to only show the balances correlated with the current year (CY). Any ideas on how to show this variance correctly? 

In layman's terms, basically need to INCLUDE data from all months relevant (Dec 2023 - Mar 2024, Dec 2024 - Mar 2025), but I only need to DISPLAY the months with the correct values for variance (Dec 2024 - Mar 2025). 

 

DAX measure: 
    

VARI Food Revenue =
    VAR CY = CALCULATE(SUM(ConsolidatedReport[Amount]), ConsolidatedReport[GLAccount] = "450000", DateDim[CurrentFiscalYear] = 0)
    VAR LY = CALCULATE(SUM(ConsolidatedReport[Amount]), ConsolidatedReport[GLAccount] = "450000", DateDim[CurrentFiscalYear] = -1, REMOVEFILTERS(DateDim[Date].[Year]))
RETURN
    CY - LY
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@getsmithed , Try using

DAX
VARI Food Revenue =
VAR CY = CALCULATE(
SUM(ConsolidatedReport[Amount]),
ConsolidatedReport[GLAccount] = "450000",
DateDim[CurrentFiscalYear] = 0,
DATESBETWEEN(DateDim[Date], DATE(2024, 12, 1), DATE(2025, 3, 31))
)
VAR LY = CALCULATE(
SUM(ConsolidatedReport[Amount]),
ConsolidatedReport[GLAccount] = "450000",
DateDim[CurrentFiscalYear] = -1,
REMOVEFILTERS(DateDim[Date].[Year]),
DATESBETWEEN(DateDim[Date], DATE(2023, 12, 1), DATE(2024, 3, 31))
)
RETURN
CY - LY

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
getsmithed
Frequent Visitor

Hi @maruthisp , 

The ConsolidatedReport[GLAccount] is of the text datatype. That is why I'm referencing GLAccount 450000 like "450000". The comparison is between the corresponding months in the amount column (which should be either a decimal or integer), which I can see you have set up in your table already.

Hi @getsmithed,

Thank you @bhanu_gautam , @maruthisp  for the helpful response.

Thanks for confirming the data type for GLAccount — using "450000" is indeed the correct approach since it's a text field.

Given the behavior you described, the updated DAX measure using explicit DATESBETWEEN for both CY and LY (as shared above) is your best approach to ensure:

CY (Dec 2024–Mar 2025) values are displayed.

LY (Dec 2023–Mar 2024) values are still included in the variance calculation, even if not shown

This avoids the issue where visual filters inadvertently remove LY context. Just make sure the measure includes both:

REMOVEFILTERS(DateDim[Date].[Year])

and

DATESBETWEEN(...)

Please continue using Microsoft Community Forum.

If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.

Regards,
Pavan.

bhanu_gautam
Super User
Super User

@getsmithed , Try using

DAX
VARI Food Revenue =
VAR CY = CALCULATE(
SUM(ConsolidatedReport[Amount]),
ConsolidatedReport[GLAccount] = "450000",
DateDim[CurrentFiscalYear] = 0,
DATESBETWEEN(DateDim[Date], DATE(2024, 12, 1), DATE(2025, 3, 31))
)
VAR LY = CALCULATE(
SUM(ConsolidatedReport[Amount]),
ConsolidatedReport[GLAccount] = "450000",
DateDim[CurrentFiscalYear] = -1,
REMOVEFILTERS(DateDim[Date].[Year]),
DATESBETWEEN(DateDim[Date], DATE(2023, 12, 1), DATE(2024, 3, 31))
)
RETURN
CY - LY

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






maruthisp
Solution Sage
Solution Sage

Hi @getsmithed ,

As per the above DAX expression, what is the below datatypes for ConsolidatedReport[GLAccount]?
I can see there is come DAX error while comparing column with INT with TEXT values.

maruthisp_0-1747197413486.png



Variance between Two Years on same Date Axis using same Amount Column.pbix

Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

 

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.