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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PowerAlchemist
New Member

I'm having trouble making calculated columns in Power BI Matrix

The simplified issue I am facing is that I have data that has muliple "Versions", where the Version is a column consisting i.e., Forecast 23 and Budget. Other columns include Values such as Net Sales. I have tried my way around and do not seem to find a way to make a calculated column or a measure in the Matrix that would show the deviation between different columns in the example:

 

PowerAlchemist_0-1708095111310.png

Instead of the Total (which is not relevant for this matrix) I would want to have columns like Budget vs Forecast 24 and Forecast 23 vs Forecast 24.

 

Here is my data set:

PowerAlchemist_1-1708095238530.png

 

I am missing something really simple or this is a more complicated task?

 

Thank you in advance 🙂

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @PowerAlchemist ,

Based on your problems, here are my answers.

Firstly I create a table as you mentioned.

vyilongmsft_0-1708500819651.png

Then you can create two new columns and write the DAX codes.

B vs F24 =
CALCULATE (
    SUM ( 'Table'[GP1] ),
    FILTER ( 'Table', 'Table'[Version] = "Budget" )
)
    - CALCULATE (
        SUM ( 'Table'[GP1] ),
        FILTER ( 'Table', 'Table'[Version] = "Forecast 24" )
    )
F23 vs F24 =
CALCULATE (
    SUM ( 'Table'[GP1] ),
    FILTER ( 'Table', 'Table'[Version] = "Forecast 23" )
)
    - CALCULATE (
        SUM ( 'Table'[GP1] ),
        FILTER ( 'Table', 'Table'[Version] = "Forecast 24" )
    )

Finally, go to the Visualizations and select the Matrix. You will get what you want.

vyilongmsft_2-1708501310490.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @PowerAlchemist ,

Based on your problems, here are my answers.

Firstly I create a table as you mentioned.

vyilongmsft_0-1708500819651.png

Then you can create two new columns and write the DAX codes.

B vs F24 =
CALCULATE (
    SUM ( 'Table'[GP1] ),
    FILTER ( 'Table', 'Table'[Version] = "Budget" )
)
    - CALCULATE (
        SUM ( 'Table'[GP1] ),
        FILTER ( 'Table', 'Table'[Version] = "Forecast 24" )
    )
F23 vs F24 =
CALCULATE (
    SUM ( 'Table'[GP1] ),
    FILTER ( 'Table', 'Table'[Version] = "Forecast 23" )
)
    - CALCULATE (
        SUM ( 'Table'[GP1] ),
        FILTER ( 'Table', 'Table'[Version] = "Forecast 24" )
    )

Finally, go to the Visualizations and select the Matrix. You will get what you want.

vyilongmsft_2-1708501310490.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DataInsights
Super User
Super User

@PowerAlchemist,

 

I would use a calculation group to accomplish this. The article below provides guidance on how to create a calculation group. You would have several calculation items: Budget, Forecast 23, Forecast 24, Budget vs Forecast 23, Forecast 23 vs Forecast 24, etc. You'll need to create explicit measures (DAX) instead of using implicit measures (automatic aggregation). After you create the calculation group, you can use it in a slicer, matrix columns, etc.

 

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-the-model-explorer-with-calculation-group-au... 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.