Forum Discussion
Customized Parameters to change the X axis dynamically.
Hi All,
I have three columns such as mentioned below---> Date, Week and Month in the calendar table. Actually I am trying to change the x-axis dynamically as per user requirements.
the thing is those three columns need to convert as one parameter to add that parameter as the x-axis and will add the same as the slicer to allow the users to change the axis. but I'm not able to filter the columns like Dates,week and month <>blank so that blank will not appear in chat and slicer
Slicer:
if we select any one of the below the same details should show in x axis.
Last 7 Day,--> 25, 24, 23, 22, 21, 20, 19, 18
Last 4 weeks-->W1, W2, W3, W4
Last 2Months-->March, Feb
| Date | Week | Month |
| 3/25/2024 | W1 | Mar |
| 3/24/2024 | W1 | Mar |
| 3/23/2024 | W1 | Mar |
| 3/22/2024 | W1 | Mar |
| 3/21/2024 | W1 | Mar |
| 3/20/2024 | W1 | Mar |
| 3/19/2024 | W1 | Mar |
| 3/18/2024 | W2 | Mar |
| 3/17/2024 | W2 | Mar |
| 3/16/2024 | W2 | Mar |
| 3/15/2024 | W2 | Mar |
| 3/14/2024 | W2 | Mar |
| 3/13/2024 | W2 | Mar |
| 3/12/2024 | W2 | Mar |
| 3/11/2024 | W3 | Mar |
| 3/10/2024 | W3 | Mar |
| 3/9/2024 | W3 | Mar |
| 3/8/2024 | W3 | Mar |
| 3/7/2024 | W3 | Mar |
| 3/6/2024 | W3 | Mar |
| 3/5/2024 | W3 | Mar |
| 3/4/2024 | W4 | Mar |
| 3/3/2024 | W4 | Mar |
| 3/2/2024 | W4 | Mar |
| 3/1/2024 | W4 | Mar |
| 2/29/2024 | W4 | Feb |
| 2/28/2024 | W4 | Feb |
| 2/27/2024 | W4 | Feb |
I hope i convaide my concern here
power DA daxdax daxdaxdax Anonymous Please help me to do this, I was strugling since a week
SurendraD , Have columns like Day(Date), week (year week), Month(Year Month) In you date table and create a field parameter on that.
After the table is created rename them to last 7 days. Last 4 week etc
Assuming there is no filter on the date you need switch measure based on selected values of field parameter
Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])
Switch( [Selected Parameter],
"Last 7 Days", calculate( [Your measure], filter(Date, Date[Date] >= today() -7 && Date[Date] <= today() )),
"Last 4 Weeks", calculate( [Your measure], filter(Date, Date[Date] >= today() -28 && Date[Date] <= today() )),
"Last 2 Month", calculate( [Your measure], filter(Date, Date[Date] >= eomonth(today(),-3)+1 && Date[Date] <= eomonth(today(),0) ))
)
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Power BI Field Parameters, Keep Axis Sort intact| Always Sort on X/Categorial Axis: https://youtu.be/GfBrB6czByw
1 Reply
- amitchandak
Super User
SurendraD , Have columns like Day(Date), week (year week), Month(Year Month) In you date table and create a field parameter on that.
After the table is created rename them to last 7 days. Last 4 week etc
Assuming there is no filter on the date you need switch measure based on selected values of field parameter
Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])
Switch( [Selected Parameter],
"Last 7 Days", calculate( [Your measure], filter(Date, Date[Date] >= today() -7 && Date[Date] <= today() )),
"Last 4 Weeks", calculate( [Your measure], filter(Date, Date[Date] >= today() -28 && Date[Date] <= today() )),
"Last 2 Month", calculate( [Your measure], filter(Date, Date[Date] >= eomonth(today(),-3)+1 && Date[Date] <= eomonth(today(),0) ))
)
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Power BI Field Parameters, Keep Axis Sort intact| Always Sort on X/Categorial Axis: https://youtu.be/GfBrB6czByw