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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
vinayganit
Frequent Visitor

Dynamic date slicer or dynamic field switch

So I have a Forecast type table to select between 2 type of forecasts from 2 different files. I have linked them to a common date table. I created a measure to calculate min and max dates of the order date of both these files based on selection. If it is a one time forecast then min of order date of that frecast file and if it is rolling min of that similarly for Max. But I added a column in date table to make a slicer with range changing based on my forecast type selection but it is returning blank or it is out of range. Is it because my selection is in front end? Now if that is not possible i can remove the date slicer and I have  aline chart so i have selected forecast as a measure which is as follows

Selected Forecast =
VAR SelectedType = SELECTEDVALUE('Forecast Type'[FC Type])
RETURN
SWITCH(
    SelectedType,
    "Rolling Forecast", CALCULATE(SUM('Rolling Forecast '[Forecast Volumne])),
    "One-Time Forecast", CALCULATE(SUM(ForecastResults_OneTime[Forecast Volume])),
    BLANK()
)
I want to switch between order date of both these columns as well in the same format. But since date cant be aggregated how will it be possible? 
DateInRange =
VAR MinDate = [MinOrderDate]
VAR MaxDate = [MaxOrderDate]
RETURN
IF(
DateTable[Date]>=MinDate && DateTable[Date]<=MaxDate,
DateTable[Date],
BLANK()
)
This was my calculation for calculated date column for which Min order date and max orderdate as seperate measures where working fine but dates where not getting filtered. It would be great if either of the solutions can be achieved
 
1 REPLY 1
amitchandak
Super User
Super User

@vinayganit , You can not use slicer values in a calculated column. If you use a measure in the column then will not consider the slicer value in the calculation.

 

You have create a measure that considers this calculation

 

If want to change the join with date table and table consider inactive join and userelationship

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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