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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MDePauw
New Member

DAX Calculation issue

Hi,

 

I'm trying to make a dax formula to calculate the date difference between the date on the column and the max(date) column in another table.

 

DIM_Kalender: Base table which is filtered by using a slicer

Dim_Kalender (2): I want a dynamic datediff() calculation between the row date value and the selected slicer value that filters table DIM_Kalender.

 

By using the formula below he however doesn't compare the max() value from the other table, but the max value in the current table. By adding the var value in a seperate calculated measure the correct max() value appears.

 

What is wrong in my DAX calculation?

 

FlagLast7Days_2 =
var LastFoundDateDataSet_2 = CALCULATE( MAX ( DIM_Kalender[Datum] ); ALLSELECTED ( DIM_Kalender ) )
var Datum = 'DIM_Kalender (2)'[Datum]
return
DATEDIFF( LastFoundDateDataSet_2 ; Datum ; DAY )

 

 

Screenshot on the following links:

https://imgur.com/IxybaYE

https://imgur.com/OhnIpwj

 

Best regards,

M

 

 

 

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@MDePauw,

 

Make sure it is a measure, not calculated column.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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