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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.