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
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))

@ 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!:
The Definitive Guide to Power Query (M)

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
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.

Top Solution Authors