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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jl20
Helper IV
Helper IV

Time Intelligence with a Dynamic Parameter?

Hi all, I'm trying to figure out a way to use the DATEADD function or similar while at the same time using a dynamic parameter for the comparison. I want to type in 30 and have it show me an existing measure, but filtered for the last 30 days. I've accomplished that successfully using the measure below (where "X Value" is the parameter):

 

MEASURE (Last X Days) = CALCULATE( [MEASURE], DATESBETWEEN('Calendar'[Date],

TODAY() - 'Comparison Period'[Comparison Period X Value]+1,TODAY()) )

 

I'd like to compare to the same period last year using DATEADD. When I try to use CALCULATE with [MEASURE (Last X Days)] as the first argument, and DATEADD for last year as the filter argument, it returns the same result as MEASURE (Last X Days). I suppose I could just subtract 365 from each of the dates above, but I would prefer to use the DATEADD function so I can do the same thing with months, quarters, with changing numbers of days.

 

Any ideas? Thanks!

1 ACCEPTED SOLUTION

Hi,

 

You may refer to my solution in this file.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
v-yuezhe-msft
Employee
Employee

@jl20,

Could you please share dummy data of your table and post expected result? We also need to know the DAX formula of the [Measure].

Regards,
Lydia

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

Hi,

 

You may refer to my solution in this file.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

That worked well. Thanks Ashish!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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