Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello!
I have sales by product and a slicer by date "BEFORE".
The result I want to get in one measure is:
- if no date is selected in the slicer, then sales for the month (MTD)
- if a date is selected in the slicer, then sales for that date.
Is this possible and how?
Solved! Go to Solution.
Thanks solution from @vicky_ , your solution is great!
Hi, @pani_victoria
Based on your description, I have created the following sample data:
I have the following two measures:
I created a date table using the following DAX expression:
Table 2 = CALENDAR(MIN('Table'[Date]),TODAY())
I'm using columns from the entire date table in the slicer:
I use the following DAX expression to create a measure that switches the MTD to the current day's breakdown:
sales =
VAR _seleteddate =
SELECTEDVALUE ( 'Table 2'[Date] )
RETURN
IF (
ISBLANK ( _seleteddate ),
[Sales MTD],
CALCULATE ( [Sales amount], 'Table'[Date] = _seleteddate )
)
Here are the results:
When the date slicer is not checked, the MTD is displayed:
If the date is selected, the details of the current day are displayed:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks solution from @vicky_ , your solution is great!
Hi, @pani_victoria
Based on your description, I have created the following sample data:
I have the following two measures:
I created a date table using the following DAX expression:
Table 2 = CALENDAR(MIN('Table'[Date]),TODAY())
I'm using columns from the entire date table in the slicer:
I use the following DAX expression to create a measure that switches the MTD to the current day's breakdown:
sales =
VAR _seleteddate =
SELECTEDVALUE ( 'Table 2'[Date] )
RETURN
IF (
ISBLANK ( _seleteddate ),
[Sales MTD],
CALCULATE ( [Sales amount], 'Table'[Date] = _seleteddate )
)
Here are the results:
When the date slicer is not checked, the MTD is displayed:
If the date is selected, the details of the current day are displayed:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
From the wording, I assume that you have a single-date slicer.
If so, then you can try wrap your calculations in an if statement. Something like:
Your Measure = IF(HASONEVALUE('Slicer Table'[Date]),
// ... your calculations for sales
, // your calculations for MTD
)
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 121 | |
| 103 | |
| 46 | |
| 30 | |
| 24 |