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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
KristinG
Frequent 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! 

 

 
1 ACCEPTED SOLUTION

Hi! 

 

I think its solved, but its not due to any of the reasons listed below. Thank you for your support. 

View solution in original post

10 REPLIES 10
v-venuppu
Community Support
Community Support

Hi @KristinG ,

Can you please share the solution and accept it as solution.This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-venuppu
Community Support
Community Support

Hi @KristinG ,

Great to hear that it's solved from your end! Could you please share the solution? It would be really helpful for others in the community who might be facing similar issues and can address them quickly. Also, I would suggest accepting your approach as the solution so that it can benefit others as well.

Thank you.

v-venuppu
Community Support
Community Support

Hi @KristinG ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi! 

 

I think its solved, but its not due to any of the reasons listed below. Thank you for your support. 

v-venuppu
Community Support
Community Support

Hi @KristinG ,

can you please share the exact sample data and expected output , so that it will be helpful for us to do some workarounds to solve the issue.

Thank you.

v-venuppu
Community Support
Community Support

Hi @KristinG ,

I wanted to check if you had the opportunity to review the information provided.If the response has addressed your query, please accept it as a solution, so other members can easily find it.

Thank you.

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.

Hi, 

Thanks for your reply! 

Your file is unfortunately showing the exact same value no matter what YearMonth I filter on, so a its a bit hard to see if ot actually solves the problem.. 

 

FBergamaschi
Solution Sage
Solution Sage

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

Hi, 
Thanks for your reply! 
Its not a data type issue, 'Calendar'[DateKey] is date format  

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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