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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KristinG
Regular Visitor

DAX give different outputs when I expect the same

Hi! I need som help here 

 

Value from selected date

CALCULATE(
        SUM('Table1'[AMOUNT]),
        ALL('Calendar')
        'Calendar'[DateKey] > MAX('Calendar'[DateKey]))
 
Value from selected date in prev year
VAR CurrentMaxDate = MAX('Calendar'[DateKey])
VAR StartDate = EOMONTH(CurrentMaxDate, -12)
RETURN
CALCULATE(
    SUM(Table1[AMOUNT]),
    ALL('Calendar'),
    'Calendar'[DateKey] > Startdate)

The measures shoud give the exact same output if I enter May 2024 in the first and may 2025 in the last - but there is a sliight difference. 
 
Value from selected date
KristinG_0-1750333191541.png

Value from selected date in prev year

KristinG_1-1750333235672.png

 

 Help me understand why there is a difference! 

 

 
2 REPLIES 2
v-venuppu
Community Support
Community Support

Hi @KristinG ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @FBergamaschi for the prompt response.

I have created PBIX file using sample data, you can implement it using your data.Please go through the attached PBIX file for your reference.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly.

Thank you.

FBergamaschi
Helper I
Helper I

Hi,

EOMONTH expectes a date as first input. I do not know what data type is your datekey column.

 

I tried this for the second measure

 

VAR CurrentMaxDate = MAX('Calendar'[Date])
VAR StartDate = EOMONTH(CurrentMaxDate, -12)
RETURN 
CALCULATE(
    SUM(Sales[SalesAmount]),
    ALL('Calendar'),
    'Calendar'[Date] > Startdate
)
 
and it works perfectly, but I used a date column of date format. So either you use a column like that or you convert the datekey into a date with the DATE DAX Function in combination with LEFT, MID, RIGHT
 
If this helped please mark this as a solution and give kudos
 
Thanks
 
Best

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.

Top Solution Authors