Forum Discussion

akos_skutovics's avatar
1 year ago

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 Q2

  • If 2023 Q4 and 2024 Q2 are selected, the output should be:
    2023 Q4, 2024 Q2

  • If Jan 2024, Feb 2024, Mar 2024, and Apr 2024 are selected, the output should be:
    Jan - Apr 2024

  • If Jan 2024, Feb 2024, Apr 2024, May 2024, and Jun 2024 are selected, the output should be:
    Jan - Feb 2024, Apr - Jun 2024

  • And so on.

10 Replies