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
Yin34
Frequent Visitor

Dynamically Pick Min Date based on slicer's selection

Hi friends, 

I am still new to Power BI, hope you guys can provide me some guidance. Here is my situation:

I would like to pick min date for each level of percentile (low, mid, and high) from each provider separately based on the condition that the percentage in PctAvailable column is greater than the corresponding percentage in slicer (on the leftside of the screenshot below). I created three columns, LowDate, MidDate, and HightDate to store the calculated min dates. Also, I added columns LowPCT, MidPCT, and HighPCT to show the selected percents from slicers for demenstration purposes. Using provider 403 as example, the LowDate is 10/13, MidDate is 12/20, and HighDate is also 12/20 based on the current selections. However, the min dates of each level don't change when different values are selected. It looks like the min dates are selected using the min percentage of each level, not dynamically update based on the selection. 

I created three tables containing the values of each slicer, called LowSelection, MidSelection, and HighSelection. 

Here are the formulas that I used for the calculation (using Low percentile calcs as example)

LowPCT= if(HASONEFILTER(LowSelection[Low]),LOOKUPVALUE(LowSelection[Low],LowSelection[Low],values(LowSelection[Low])))

LowDate=

CALCULATE(min('Table'[SlotDatetimeDTS]),FILTER('Table','Table'[ProviderID]=EARLIER('Table'[ProviderID])&&'Table'[PctAvailable]>[LowPCT]))
Please let me know which parts do I have fix or adjust? 
PowerBI Community_3.png
 
 
 
 
 
 
 
 
Thank you so much for your time!
2 REPLIES 2
Greg_Deckler
Super User
Super User

@Yin34 Correct, calculated columns are not dynamic based upon user input. You would need a measure like:

LowDate = 
  VAR __LowPCT = [LowPCT]
RETURN
  CALCULATE(MIN('Table'[SlotDatetimeDTS]),FILTER(ALL('Table'),'Table'[PctAvailable]>__LowPCT))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg @Greg_Deckler 

Thanks for the reply!

For the measure you proposed, is there a way to add the condition for ProviderID? Because I would like to pick the min date for each provider separately. Like in the screenshot, the LowDate for provider 403 is 10/13, but the min date for other providers could be different if his/her min SlotDateTimeDTS with PctAvailable >10% is not 10/13. It looks like your formula pick the overall min date across all the providers. 

 

Thank you so much!

 

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.

Jan NL Carousel

Fabric Community Update - January 2025

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