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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply

Relative date filter true DAX

Hi all,

 

I'll try to get an additional column in my 'order product' table based on a relative (rolling) date.

I tought i figgured it out, but it just don't work. Can someone help me out with the code?

 

Quantity L30D = CALCULATE(SUM('Order Product'[Quantity]), DATESBETWEEN('Order'[ActivatedDate],MIN('Order'[ActivatedDate]-30),MIN('Order'[ActivatedDate])))

 The error is: De functie MIN accepteert alleen een kolomverwijzing als argument. ==> The function MIN only accept a column reference as an argument.

 Knipsel1.JPG

What am I doing wrong?

Thanks!

Dennis

 

 

 

1 ACCEPTED SOLUTION

Hi @dennisdepoorter,

 

That's impossible. I have added some comments in the snapshot below. It's a COMMA in the formula while it's a DOT in the error message. 

1. Please upgrade the Desktop to the latest version.

2. Try this formula.

Quantity L30D = 
CALCULATE (
    SUM ( 'Order Product'[Quantity] ),
    DATESBETWEEN (
        'Order'[ActivatedDate].[Date],
        (MIN ( 'Order'[ActivatedDate] ) - 30),
        MIN ( 'Order'[ActivatedDate] )
    )
)

Relative_date_filter_true_DAX3

 

Best Regards,
Dale

Community Support Team _ Dale
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

15 REPLIES 15
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Dennis,

 

If this formula can give you the desired result, you can amend it like below. It's a grammar error.

 

Quantity L30D =
CALCULATE (
    SUM ( 'Order Product'[Quantity] ),
    DATESBETWEEN (
        'Order'[ActivatedDate],
        MIN ( 'Order'[ActivatedDate] ) - 30,
        MIN ( 'Order'[ActivatedDate] )
    )
)

 

Best Regards,
Dale

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

@v-jiascu-msftthe code you provide isn't correct..

 

. Knipsel1.PNG

 

The error messages is (translated from dutch): The Syntax for MIN isn't correct. DAX(CALCULATE ( SUM ( 'Order Product'[Quantity] ), DATESBETWEEN ( 'Order'[ActivatedDate], MIN ( 'Order'[ActivatedDate] ) - 30. MIN ( 'Order'[ActivatedDate] ) )))).

 

The problem is in the ")" it should be:

 

Quantity L30D = 
CALCULATE (
    SUM ( 'Order Product'[Quantity] ),
    DATESBETWEEN (
        'Order'[ActivatedDate],
        MIN ( 'Order'[ActivatedDate]  - 30),
        MIN ( 'Order'[ActivatedDate] )
    )
)

But then the error: "The MIN function only accepts a column reference as an argument"

 
 
 

Hi @dennisdepoorter,

 

Is [ActiveatedDate] a column or a measure? I made a few adjustments. It worked in my test.

Relative_date_filter_true_DAX

 

Best Regards,
Dale

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

@v-jiascu-msft  I did rebuild it (3 times Smiley Frustrated), but error keep showing up:

 

Knipsel1.JPG

 

hmmmm 😞

thanks anyway... I can rebuild the database with less and changed data... but thats some hours work Smiley Sad

 
 

@v-jiascu-msft

 

ActivatedDate is a column with dates on when the order has been activated.

Thanks for the feedback all-ready, but don't work for columns that way (I think)

 
 

Hi @dennisdepoorter,

 

Can you share the file? It works as both a calculated column and a measure in my side.

Please mask the sensitive parts.

 

Best Regards,
Dale

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

@v-jiascu-msft

 

The file is connected to our Salesforce enviroment... all data is confidential... is there another way?

Maybe this printscreen of the DTB can help you out?

 

 

 
 Knipsel1.PNG
 
 
 Knipsel2.JPG
 

Hi @dennisdepoorter,

 

I created a similar model. But no issues occurred. The most important thing is it shouldn't return an error message about the MIN function. I'm very sure. I would suggest you delete it and rebuild it again.

 

 

Best Regards,
Dale

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

@v-jiascu-msft

 

I made a test enviroment... and have the same error.

Would be nice if you can give it a view!

 

https://www.dropbox.com/s/vupkg4chx07v5hf/test.pbix?dl=0

 
 Many many thanks!!!
 
 

Hi @dennisdepoorter,

 

It's quite strange. I saw a dot rather a comma after "30" when I opened the report. I changed it into a comma. It ran into another issue, which can be solved easily by adding a Date table or using a formula like below.

Quantity L30D = 
CALCULATE (
    SUM ( 'Order Product'[Quantity] ),
    DATESBETWEEN (
        'Order'[ActivatedDate].[Date],
        MIN ( 'Order'[ActivatedDate] ) - 30,
        MIN ( 'Order'[ActivatedDate] )
    )
)

Relative_date_filter_true_DAX2

 

Please don't share sensitive data here.

 

Best Regards,
Dale

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

@v-jiascu-msftthanks for the help, but I still have te same error... So I don't know what's going wrong 😞

 

Knipsel1.JPG

 
 

Hi @dennisdepoorter,

 

That's impossible. I have added some comments in the snapshot below. It's a COMMA in the formula while it's a DOT in the error message. 

1. Please upgrade the Desktop to the latest version.

2. Try this formula.

Quantity L30D = 
CALCULATE (
    SUM ( 'Order Product'[Quantity] ),
    DATESBETWEEN (
        'Order'[ActivatedDate].[Date],
        (MIN ( 'Order'[ActivatedDate] ) - 30),
        MIN ( 'Order'[ActivatedDate] )
    )
)

Relative_date_filter_true_DAX3

 

Best Regards,
Dale

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

Hi Dale,

 

 

THANKS THANKS THANKS!!! it was all in the ")" 🙂

Altough the formula works, it doesn't show what I want, but I will now dig into it myself...

 

THANKS THANKS THANKS!!!!

 
 

It's my pleasure. I'm so glad you can move on now.

 

Best Regards,
Dale

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

Hi @dennisdepoorter,

 

I created a similar model. But no issues occurred. The most important thing is it shouldn't return an error message about the MIN function. I'm very sure. I would suggest you delete it and rebuild it again.

 

 

Best Regards,
Dale

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors