Forum Discussion

napsebi's avatar
napsebi
Regular Visitor
7 years ago
Solved

Convert date to Quarter year

Hi, I'm trying to create a date table following the instruction that I found on https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi but I have an incorrect syntax error to create a Quarter column:

 

Quarter = IF('Date Table'[Month Number]<4,"Qtr 1",IF('Date Table'[Month Number]<7,"Qtr 2",IF('Date Table'[Month Number]<10,"Qtr 3","Qtr 4")))
 
Please, could you help me?
Thx
  • hi, napsebi 

    I have test it again, It still works well. there is error in it.

    And If you could try these two formulae if they could work

    Column = IF('Date Table'[Month Number] in {1,2,3},"Qtr 1", IF('Date Table'[Month Number] in {4,5,6},"Qtr 2", IF('Date Table'[Month Number] in {7,8,9},"Qtr 3","Qtr 4")))
    Column 2 = IF('Date Table'[Month Number]<4,1,IF('Date Table'[Month Number]<7,2,IF('Date Table'[Month Number]<10,3,4)))

    If still has the issue, please share your sample pbix file for us have a test

    You can upload it to OneDrive and post the link here. Do mask sensitive data before uploading.

     

    Best Regards,

    Lin

     

     

     

5 Replies

  • judspud's avatar
    judspud
    Icon for Solution Supplier rankSolution Supplier

    Hi napsebi 

     

    Please use the following column code:

     

    Quarter = "Quarter " & ROUNDUP('Date Table'[Month Number]/3,0)

     

    Please accept this solution if it provides what you require.

     

    Thanks,

    George

  • v-lili6-msft's avatar
    v-lili6-msft
    Icon for Community Support rankCommunity Support

    hi, napsebi 

    I have tested the formula on my side, but not reproduce the issue.

    If the 'Date Table'[Month Number] column is a numeric type?

     

    If not your case, please share your sample pbix file, just with this table.

     

    Best Regards,

    Lin

     

      • v-lili6-msft's avatar
        v-lili6-msft
        Icon for Community Support rankCommunity Support

        hi, napsebi 

        I have test it again, It still works well. there is error in it.

        And If you could try these two formulae if they could work

        Column = IF('Date Table'[Month Number] in {1,2,3},"Qtr 1", IF('Date Table'[Month Number] in {4,5,6},"Qtr 2", IF('Date Table'[Month Number] in {7,8,9},"Qtr 3","Qtr 4")))
        Column 2 = IF('Date Table'[Month Number]<4,1,IF('Date Table'[Month Number]<7,2,IF('Date Table'[Month Number]<10,3,4)))

        If still has the issue, please share your sample pbix file for us have a test

        You can upload it to OneDrive and post the link here. Do mask sensitive data before uploading.

         

        Best Regards,

        Lin