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
bhurru
Helper I
Helper I

Dynamic filter condition of a measure

Hi, I have couple of measures like Calculate(<expr>,Datesinperiod(CalenderDate,<startDate>,Number of interval,Interval)).

Also I have time period slicer having 4 values

8Weeks

26 Weeks

2 Quarters

24 Months

Now I want above measure to dynamically change DatesinPeriod filter according to the TimePeriod Slicer selection user make.

 

I know one approach by creating measures for all time period and then using Selectedvalue make them dynamic. This is all throughout the communities. My problem is by this approach I  have to create 16 measures for one metric and there are 6 metric.  

 

16 measures for one metric as in When user select 8 Weeks from Time Period slicer, then I need to show Curr4Weeks, Prev4Weeks,Delta and %Change. Hence 4*4(4 time period) = 16. 

 

Is it possible to only make this happen by dynamically writing DatesinPeriod filter condition in measure definition in some way ? Or if there is some other way to achieve this.

 

 

2 REPLIES 2
vanessafvg
Super User
Super User

switch statement() might work

https://www.thedataschool.com.au/danica-hui/switching-measures-and-titles-dynamically-in-power-bi/




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.