Forum Discussion

qwertzuiop's avatar
qwertzuiop
Advocate III
3 years ago
Solved

Calculated Column (From Month Values to Average Quarter Values)

Dear Power BI-Community

Following problem to solve:

Let's assume this table:
Rating for Products

ProductMonthRating (Monthly)QuarterAVG Rating (Quarterly) 
A01.01.20224.51 
A01.02.20224.61 
A01.03.20224.714.6
A01.04.20224.42 
A01.05.20224.22 
A01.06.20223.824.1
B01.01.20222.51 
B01.02.20222.91 
B01.03.20222.412.6
B01.04.20222.72 
B01.05.20222.22 
B01.06.20221.922.3


Do you guys know a way to add a calculated column in Power BI which calculates the quaterly average?

Finally I would like to create such a visual (Montly and AVG Quarterly combined)


Thank you very much for your contribution

Cheers

qwertzuiop

  • ribisht17's avatar
    ribisht17
    3 years ago

    Would you like to try with Bar Chart ?

    For comparision Bar can be a good option here

     

    Solution = IF( CALCULATE(MAX('Average Rating'[Month]),
    ALLEXCEPT('Average Rating','Average Rating'[Quarter]))='Average Rating'[Month],'Average Rating'[Average Column],0)

    With line it can give a false picture

     

    Regards,

    Ritesh

    Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
    My YT Channel Dancing With Data !! Connect on Linkedin !! PL 300 Certification Series

     

4 Replies

  • qwertzuiop 

     

    Please use this DAX

    Average Column = CALCULATE(AVERAGE('Average Rating'[Rating (Monthly)]),ALLEXCEPT('Average Rating','Average Rating'[Product],'Average Rating'[Quarter]))

     


     

    Regards,
    Ritesh
    • qwertzuiop's avatar
      qwertzuiop
      Advocate III

      Thank you so much for your support ribisht17
      I will accept your answer as solution.

      Maybe you can help me out a bit more.
      Is there a way to set all the non marked cell to blank.
      In this case i would only have one value per quarter


      As an example
      Don't like that Quarter has also 3 values per Month

       



      Cheers
      qwertzuiop

       

      • ribisht17's avatar
        ribisht17
        Super User

        Would you like to try with Bar Chart ?

        For comparision Bar can be a good option here

         

        Solution = IF( CALCULATE(MAX('Average Rating'[Month]),
        ALLEXCEPT('Average Rating','Average Rating'[Quarter]))='Average Rating'[Month],'Average Rating'[Average Column],0)

        With line it can give a false picture

         

        Regards,

        Ritesh

        Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
        My YT Channel Dancing With Data !! Connect on Linkedin !! PL 300 Certification Series

         

  • hi qwertzuiop 

    try like:

    NewColumn =
    AVERAGEX(
       FILTER(
             TableName,
             TableName[Product]=EARLIER(TableName[Product])&&TableName[Quarter]=EARLIER(TableName[Quarter])
        ),
        TableName[Rating (Monthly)]
    )