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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
bhalicki
Helper II
Helper II

Matrix, Measures, ISINSCOPE and Totals

Hi,

 

I want to customise the total in a matrix visualisation (instead of showing a count, I want to show the count and percentage of total count - as a string).  Is there a way to use ISINSCOPE with a switch statement to tell if the total row is in scope and therefore use a specific calculation?

bhalicki_0-1647080270140.png

Thanks,

Ben.

 

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

Hi @bhalicki ,

 

You may try these Measures.

 

CountStatus =
VAR AllStatus =
    CALCULATE ( COUNT ( 'Table'[Status] ), ALL ( 'Table' ) )
VAR Status_ =
    COUNT ( 'Table'[Status] )
VAR StatusPer =
    FORMAT ( Status_ / AllStatus, "#%" )
VAR RowTotal =
    SWITCH (
        TRUE (),
        NOT ( ISINSCOPE ( 'Table'[Status] ) ),
            Status_ & "," & StatusPer,
        Status_
    )
RETURN
    IF (
        HASONEFILTER ( 'Table'[ProjectDesc] ),
        RowTotal,
        Status_ & "," & StatusPer
    )

 

 

Then, the result should look like this.

vcazhengmsft_0-1647323390012.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @bhalicki ,

 

You may try these Measures.

 

CountStatus =
VAR AllStatus =
    CALCULATE ( COUNT ( 'Table'[Status] ), ALL ( 'Table' ) )
VAR Status_ =
    COUNT ( 'Table'[Status] )
VAR StatusPer =
    FORMAT ( Status_ / AllStatus, "#%" )
VAR RowTotal =
    SWITCH (
        TRUE (),
        NOT ( ISINSCOPE ( 'Table'[Status] ) ),
            Status_ & "," & StatusPer,
        Status_
    )
RETURN
    IF (
        HASONEFILTER ( 'Table'[ProjectDesc] ),
        RowTotal,
        Status_ & "," & StatusPer
    )

 

 

Then, the result should look like this.

vcazhengmsft_0-1647323390012.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

tamerj1
Super User
Super User

Hi @bhalicki 

you can use 

IF ( NOT HASONEVALUE ( Table[ProjectDesc ), your calculation)

Helpful resources

Announcements
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors