cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
matrix_user
Helper II
Helper II

Calculated column Jan - Mar, Apr - Jun, Jul - Sep, Oct - Dec

I am seeking a calculated column dax to display quarter dates (01/01/2022 - 31/03/2022 etc) but also have the ability to change the format (01 Jan 2022 - 31 Mar 2022) 

 

Thank you

1 ACCEPTED SOLUTION

Yr-Qtr = 
YEAR( [Date] ) & " "
    & SWITCH(
        QUARTER( [Date] ),
        1, "Jan-Mar",
        2, "Apr-Jun",
        3, "Jul-Sept",
        "Oct-Dec"
    )

CNENFRNL_0-1656597122881.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
croberts21
Post Patron
Post Patron

Are you wanting to create the dates in each quarter to sum numbers in each quarter? Try using DATESQTD as a filter to the SUMX function. https://docs.microsoft.com/en-us/dax/datesqtd-function-dax

Is that what you want? What is the final task you want to accomplish?

You can also search the internet for quarter calculations in Power BI. https://www.google.com/search?channel=nus5&client=firefox-b-1-d&q=%2B%22power+bi%22+quarter+calculat... 

 

I want the functionality to put for example, the date of 15/2/22 into the "Jan-Mar 22" category. I want it in calculated column. So I want to learn how to write a dax that will acomplish the "Jan-Mar 22" result.

Yr-Qtr = 
YEAR( [Date] ) & " "
    & SWITCH(
        QUARTER( [Date] ),
        1, "Jan-Mar",
        2, "Apr-Jun",
        3, "Jul-Sept",
        "Oct-Dec"
    )

CNENFRNL_0-1656597122881.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

Thanks CNENFRNL,

The DAX is what I needed. I made a change to it - so that the year is at the end.

 

Cheers

SpartaBI
Community Champion
Community Champion

@matrix_user check out this article:https://www.daxpatterns.com/standard-time-related-calculations/
Read it carefully and it will give you what you want (you will see there how to create a data table and it will point you to what you need and much more).


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors