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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Dear All,
I am trying to re-create a time selection slicer (see the DAX formula below):
There are 24 months in 'Calendar Year/Month', from Jan 2021 to Dec 2022. (Those future months include only Budget figures).
What I want to achieve:
I wish that DATESMTD, DATEYTD etc. to display figures in relation to current month, not the MAX in the date table (i.e. Dec 2022).
Time Selection =
Union(
ADDCOLUMNS(
DATESMTD('Date'[Calendar Year/Month]),
"Selection", "MTD"
),
ADDCOLUMNS(
DATESYTD('Date'[Calendar Year/Month]),
"Selection", "YTD"
),
ADDCOLUMNS(
PREVIOUSMONTH(DATESMTD('Date'[Calendar Year/Month])),
"Selection", "Previous Month"
),
ADDCOLUMNS(
DATESINPERIOD('Date'[Calendar Year/Month],MAX('Date'[Calendar Year/Month]),-12,Month),
"Selection", "Rolling 12 months"
))
With this formula above I get a view as follow:
I have tried DATESINPERIOD, DATESBETWEEN etc. functions to no avail.
Any tip/suggestion would be highly appreciated.
Thank you, and wish you all a fabulous weekend.
Solved! Go to Solution.
Hi:
You can try this pattern. I'm using my columns as I can't see yours, but this should help you on this one.This table is in a separate bi-directional relationship with a second date table (DATESII.) DATESII Table is like this:
Add Calc Col to DATESII
I'll paste a couple images below the DAX. The slicer formula is a separate table (MTD,QTD,YTD,etc) and I will paste that in last. I'm providing more than asked for as I'm anticipating you will want to use these other pieces..
YOUR QUESTION: -note use of second Date Table.
MODEL
Slicer Table -
Hi @Giorgi1989
I am so glad to hear that your problem has been solved , then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Another method is to use calculation groups.
https://www.sqlbi.com/articles/introducing-calculation-groups/
Hi:
You can try this pattern. I'm using my columns as I can't see yours, but this should help you on this one.This table is in a separate bi-directional relationship with a second date table (DATESII.) DATESII Table is like this:
Add Calc Col to DATESII
I'll paste a couple images below the DAX. The slicer formula is a separate table (MTD,QTD,YTD,etc) and I will paste that in last. I'm providing more than asked for as I'm anticipating you will want to use these other pieces..
YOUR QUESTION: -note use of second Date Table.
MODEL
Slicer Table -
Hi, thank you. This is pretty close to what I did! 🙂
Hi:
Are you able to mark as solution? Thanks..
Update: I actually figured it out. Everything works perfectly now!!!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 13 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |