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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Different Calculation for Different Row Levels in Matrix Visual

Hi all,

 

Below is a simplified example of the table that I have and the result that I got.

 

2a46e4d7-2776-4b31-81cb-25511f902033.jpg87f99c51-d0cc-4804-8f52-d4d25f33c264.jpg

 

What I'm trying to do is, instead of adding the Actual values of all Measures in one store, I want the Store row to show whether that particular Store hit all the measures or not. For example, Lidl 1 Row to have value 1 (instead of 3) as 'Sum of ACTUAL' because all the Measures (A, B, C) are 1. Also, I need the Chain Level to have the sum of values on the Store level.

 

Can anyone give me an advice on this?

 

Thank you!

1 ACCEPTED SOLUTION

Hey @Anonymous ,

maybe this measure: provides what you are looking for:

Measure 2 = 
var isinScopeStore = ISINSCOPE('new 18'[STORE] )
return
IF( isinScopeStore
    , CALCULATE( SUM('new 18'[ACTUAL] ) )
    , COUNTROWS(
        FILTER(
            ADDCOLUMNS(
                VALUES( 'new 18'[STORE] )
            , "noOfYes" , CALCULATE( SUM( 'new 18'[ACTUAL] ) )
            )
            , [noOfYes] = 3
        )
    )
)

The result based on your sample data:
image.png
Hopefully, this provides what you are looking for.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey @Anonymous ,

 

please provide sample data that can easily be copied to a pbix file,
If measures are DAX measures, than you need to provide a pbix that also contains the measure definition.
Two additional questions, what is the expected result on the chain level and what are possible values of the measures A, B, and C?

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi @TomMartens 

 

Here's the sample data that I use:

 

CHAIN,STORE,MEASURE,ACTUAL
Tesco,Tesco 1,A,1
Tesco,Tesco 1,B,0
Tesco,Tesco 1,C,1
Tesco,Tesco 2,A,1
Tesco,Tesco 2,B,1
Tesco,Tesco 2,C,1
Lidl,Lidl 1,A,1
Lidl,Lidl 1,B,1
Lidl,Lidl 1,C,1
Lidl,Lidl 2,A,0
Lidl,Lidl 2,B,0
Lidl,Lidl 2,C,0

 

MEASURE column is not a DAX measure. It's just a list yes/no questions, but to simplify I use A, B, C. Whereas ACTUAL is the answer of the question under MEASURE column (1 for yes and 0 for no). 

 

The expected result on the chain level is the sum of values on the store level.

 

TIA!

Hey @Anonymous ,

maybe this measure: provides what you are looking for:

Measure 2 = 
var isinScopeStore = ISINSCOPE('new 18'[STORE] )
return
IF( isinScopeStore
    , CALCULATE( SUM('new 18'[ACTUAL] ) )
    , COUNTROWS(
        FILTER(
            ADDCOLUMNS(
                VALUES( 'new 18'[STORE] )
            , "noOfYes" , CALCULATE( SUM( 'new 18'[ACTUAL] ) )
            )
            , [noOfYes] = 3
        )
    )
)

The result based on your sample data:
image.png
Hopefully, this provides what you are looking for.

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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