Forum Discussion
Power BI Slicer
- 2 years ago
Hi, Jetlee_V
Measure = IF(SELECTEDVALUE(Sheet1[First Monday])=CALCULATE(MAX(Sheet1[First Monday]),ALL(Sheet1)),1,0)Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Certainly! It sounds like you want to set a default value for a slicer in Power BI that represents the latest date in your dataset. You're on the right track by using measures, but let me guide you through a step-by-step approach to achieve this:
Create a Date Table: If you don't have a Date table in your data model, create one. This table should contain all dates in your dataset. You can use the "New Table" option in Power BI and use a formula like:
DateTable = CALENDAR(MIN('YourTable'[Date]), MAX('YourTable'[Date]))
Replace 'YourTable' with the actual name of your table and 'Date' with the actual date column name.
Create a Measure for Latest Date: Create a measure that calculates the latest date in your data. You can use the following DAX formula:
LatestDate = MAX('YourTable'[Date])
Replace 'YourTable' and 'Date' as before.
Set Slicer Default Value: Now, go to the page where you have your slicer. Click on the slicer, go to the Format pane, and under General, you will find a section called "Default value." Set the default value to the measure you just created (LatestDate).
Dynamic Monday Date: If you want the default value to change every Monday, you can modify the measure for LatestDate to consider the latest Monday. You can use a formula like this:
LatestMonday = CALCULATE(MAX('YourTable'[Date]), WEEKDAY('YourTable'[Date]) = 1)
This will give you the latest Monday date in your data.
Update Default Value in Slicer: Set the default value for the slicer to be the measure LatestMonday.
Now, every time you refresh your data, the slicer will default to the latest Monday, and it will automatically update to the new Monday after each refresh. Adjust the column and table names in the formulas according to your actual data model.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.