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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jslade
Frequent Visitor

Help Filtering a Card/ Chart Based on Dynamic Dates

I need to filter a card and chart visual by a date range that is being selected in a slicer.  For example, the user will pick 3/15 in the As Of Slicer and a year in the Year Slicer.  I need to calculate the Fill for the past 15 days of the As Of Slicer for those two visuals.  The other visuals will filter on the next holiday and for the entire year.  I was trying to use Calculation Groups, but I haven't used them before and not sure how to use them as a filter.  Below is the screenshot of my report.  The other option is to do it as a Filtered Measure but I have been getting different errors with it.  I'm guessing I need to do it as a SUMX so that I can get the individule calculations for each date in my chart.  I've been trying to use Varaiables with the filtered measure, but I keep getting errors (usually mullitple values were returned errors).  Below is what I was trying with different calculation functions.

 

Actualized Fill Begin = VAR AsOfDate = SELECTEDVALUE(FactDOR[As Of Date])
VAR YearSel = SELECTEDVALUE(DimDate[Year])
VAR Interval = MAX(FactDOR[Increment])
VAR BeginDate = DATEVALUE(AsOfDate) - Interval
RETURN
CALCULATE(?)

 

jslade_0-1651013833149.png

 

Any Ideas?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jslade , if you select a date and want to display a trend of more than the selected date/dates, Then you need an independent date table

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@jslade , if you select a date and want to display a trend of more than the selected date/dates, Then you need an independent date table

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you that helped me get it working.  I didn't have to create the second date table but the video of the measures helped me to get it to work.  My measure worked as:

Actualized Fill = var MaxDate = SELECTEDVALUE(FactDOR[As Of Date])
var MinDate = IF(DAY(MaxDate) < 20, DATE(YEAR(MaxDate), MONTH(MaxDate), 1), DATE(YEAR(MaxDate), MONTH(MaxDate), 15))
RETURN
CALCULATE([Incremental Fill],FILTER('FactDOR', FactDOR[Date] >= MinDate && FactDOR[Date] <= MaxDate))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.