Forum Discussion
Use What-If parameter for selecting a date interval
- 4 years ago
A calculated column won't work as it is only calculated during data refresh, it does not take into account any filters or slicers so won't update when your user changes the what if parameter.
You could create a calculation group with a single calculation item, something like
Filtered days calculation = VAR numDays = SELECTEDVALUE ( 'What if parameter'[Num days] ) VAR baseDate = TODAY () VAR startDate = baseDate - numDays VAR endDate = baseDate + numDays RETURN CALCULATE ( SELECTEDMEASURE (), DATESBETWEEN ( 'Date'[Date], startDate, endDate ) )then apply that as a filter to the visuals which you want to be filtered
Hello, sorry! I don't have the habit to do this, I really need to learn. So I did add the calculation group/item in tabular editor and then added this as a filter to my visual, but it is not filtering anything when selecting the calculation item...
Can you understand from my screenshots what I am not doing correctly?
Thanks!
Kind regards
Valeria
Do you have a proper measure on your visual, rather than just dragging a column on to it and letting Power BI do an automatic aggregation ?
Is it possible to share your PBIX file with any confidential information removed ?
- ValeriaBreve4 years agoPost Partisan
Hello, yes I do have a proper measure - a sum of an amount. My PBIX file has a ton of confidential info but I will try to build a similar one (as soon as I have some time available) and send it to you - should I upload it here or send via e-mail? Thanks!
- johnt754 years agoSuper User
You'd need to use a service like We Transfer, or share a link directly from Google Drive or OneDrive. You can either post the link here or send me a private message
- ValeriaBreve4 years agoPost Partisan
great - that works. I will post again as soon as I can compile a pbix without confidential info. Thanks!