Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kashahzad
Frequent Visitor

How to join a letter with a quarter number ( Q with 1 to make it Q1)

Hello folks,

 

I created a slicer to show the quarters but the slicer shows the numbers for each quarter i.e 1 2 3 4,  however, I want this to be Q1, Q2, Q3 and Q4. I decided to use the concatenate function but the function takes only the text values and not the column reference. Any ideas how I can achieve this? I'll appreciate your help.

 

Thanks!

 

 

calendar.png

1 ACCEPTED SOLUTION

 Hi @AntrikshSharma 

 

For some reasons your formula was not working but it gave me a hint. I just used switch function and it worked, so I added a a new column to the table with the switch formula mentioned below and it is now showing me what I wanted, but thanks a lot for taking the time out to look into my question. You deserve a kudos.

 

Quarters = SWITCH ('Calendar'[QuarterOfYear],1,"Q1",2,"Q2",3,"Q3",4,"Q4")

 

 

View solution in original post

7 REPLIES 7
harshnathani
Community Champion
Community Champion

Hi @kashahzad ,

 

 

Create a Calculated Column in your Calendar Table.

 

QuarterName =
"Q"
    & INT (
        DIVIDE (
            Calendar[MonthOfYear],
            4
        )
    ) + 1

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

AntrikshSharma
Community Champion
Community Champion

If you are trying to add a column, you could use 

Quarter= FORMAT ( Dates[Date], "\QQ" )

 

Hi @AntrikshSharma 

Thank you for looking into it, I do not have the column with dates, I have separate columns for months, quarters and years, so this function does not fit.

Can you show what your columns look like? 

Hi @AntrikshSharma,

 

I have added the image in the original question.

You could try this:

Quarter = 
VAR MonthName = Dates[Month]
VAR Result =
    SWITCH (
        TRUE (),
        MonthName IN { "January", "February", "March" }, "Q1",
        MonthName IN { "April", "May", "June" }, "Q2",
        MonthName IN { "July", "August", "September" }, "Q3",
        "Q4"
    )
RETURN
    Result

or 

just used use Ampersand to concatenate: "Q " & QuarterOfYear

 Hi @AntrikshSharma 

 

For some reasons your formula was not working but it gave me a hint. I just used switch function and it worked, so I added a a new column to the table with the switch formula mentioned below and it is now showing me what I wanted, but thanks a lot for taking the time out to look into my question. You deserve a kudos.

 

Quarters = SWITCH ('Calendar'[QuarterOfYear],1,"Q1",2,"Q2",3,"Q3",4,"Q4")

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors