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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JørgenWulff
Frequent Visitor

Simpel DAX code does not work - even that I found the code on SQLBI and is old code for my files

Hi usergroup

I have a small code of DAX, but for some reason it will not accept my YEAR argument in DATEADD. I have experienced similar issues with other DAX Expressions lately. I have a suspicion that it is due to me doing training with danish settings in some Power BI templates, but in other I use English settings.

But can anybody either explain, what is wrong with the DAX or tell me why is this happens and how to solve it? (I have tried to change to ; but that did not help)

 

JrgenWulff_0-1659536678424.png
Best regards
Jørgen

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JørgenWulff ,

 

As far as I know, your calcualte logic should be correct. Here I create a sample to have a test and it works well.

RicoZhou_0-1659940982934.png

You can use my code and try again.

 

Measure = 
CALCULATE([Total Amount],DATEADD( 'DimDate'[Date],-1,YEAR))

 

Best Regards,
Rico Zhou

 

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

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @JørgenWulff ,

 

As far as I know, your calcualte logic should be correct. Here I create a sample to have a test and it works well.

RicoZhou_0-1659940982934.png

You can use my code and try again.

 

Measure = 
CALCULATE([Total Amount],DATEADD( 'DimDate'[Date],-1,YEAR))

 

Best Regards,
Rico Zhou

 

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

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.