Forum Discussion
DAX Date Range Summary
Does anyone have effective DAX code for summarizing a selected date range in an easily readable format for both continuous and non-continuous periods?
I typically use a slicer with these columns:
- Year (2023, 2024)
- Quarter (Q1, Q2)
- Month (Jan, Feb)
Or structured like this:
- Year (2023, 2024)
- Year-Month (2023-01, 2023-02)
Expected output examples:
If 2023 Q4, 2024 Q1, and 2024 Q2 are selected, the output should be:
2023 Q4 - 2024 Q2If 2023 Q4 and 2024 Q2 are selected, the output should be:
2023 Q4, 2024 Q2If Jan 2024, Feb 2024, Mar 2024, and Apr 2024 are selected, the output should be:
Jan - Apr 2024If Jan 2024, Feb 2024, Apr 2024, May 2024, and Jun 2024 are selected, the output should be:
Jan - Feb 2024, Apr - Jun 2024And so on.
10 Replies
- MFelixSuper User
Hi akos_skutovics ,
Check this blog post forom SQLBI.
https://www.sqlbi.com/blog/alberto/2018/12/20/displaying-a-list-of-selected-months/
This is for months but you can adjust it for a time frame
- lbendlinSuper User
What if November 2023, December 2023 and January 2024 are selected?
- akos_skutovicsHelper I
I would expect Nov 2023 - Jan 2024
- lbendlinSuper User
Sounds like a nice project. There will be lots of pitfalls (for example when someone selects 2024 Q1 and September 2023) but it will be fun to explore all the intricacies of ISINSCOPE. Good luck.
Note: Is that something that your users asked for? What is the business value? Why not use the filter icons?