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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rflora
Frequent Visitor

Add totals in Matrix when the data is UNICHAR character

Hi Folks,

I have a matrix visualization that uses a UNICHAR(10003) character to validate whether there is data or not in specific countries by Test (see image). The issue is with the totals where instead of a count of the data (with a number), it has the UNICHAR character as well. I don't see where i can change the type of data in the total to make it a count. 

 

example.png

 

Can someone help turn the total in a numerical sum? Thanks!

Rui

1 ACCEPTED SOLUTION

Hi @rflora

Do the Test1... Test3 come from another hierarchy column (assume it is called "Test") in your table? If so, try below measure:

New measure 3 = 
VAR unirows =
    CALCULATE (
        DISTINCTCOUNT ( 'TestData'[Value] ),
        FILTER ( 'TestData', NOT ( ISBLANK ( [Measure1] ) ) )
    )
RETURN
    IF (
        ISINSCOPE ( 'TestData'[Test] ) && ISINSCOPE ( 'TestData'[City] ),
        [Measure1],
        unirows
    )
022301.jpg
Kindly let me know if this works.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

7 REPLIES 7
PaulDBrown
Community Champion
Community Champion

@rflora 

What is the measure you are using for the UNICHAR?

You could try:

New measure with totals =
VAR unirows =
    CALCULATE (
        COUNTA ( Table[Country] ),
        FILTER ( Table, NOT ( ISBLANK ( [your UNICHAR measure] ) ) )
    )
RETURN
    IF ( ISINSCOPE ( Table[Country] ), [your UNICHAR Measure], unirows )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Measure 2 = var a= COUNT(Merge1[Source Value]) return IF(ISBLANK(a),BLANK(),unichar(10003))

This is how my measure is built. How could it be twicked? 

Apologies but i don't have much knowledge in DAX.

@rflora 

Try this measure:

New measure with totals =
VAR unirows =
    CALCULATE (
        COUNTA ( Table[Country] ),
        FILTER ( Table, NOT ( ISBLANK ( [measure 2] ) ) )
    )
RETURN
    IF ( ISINSCOPE ( Table[Country] ), [measure 2], unirows )

 (where [measure 2] is the measure you currently have). Remove your [measure 2] from the visual and use this [New measure with totals].





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






New measure with totals = 
VAR unirows =
    CALCULATE (
        DISTINCTCOUNT('Test table'[Source Value] ),
        FILTER ('Test table', NOT ( ISBLANK ( [measure] ) ) )
    )
RETURN
    IF ( ISINSCOPE ( 'Test table'[Region]), [measure], unirows )

@PaulDBrown Thanks! I made a few changes to get closer to what i need. I added a distinct count since I have many different entries in my DB and also i updated the return to be the "Region" which is the higher level, making the total by test accurate.

 

The only thing missing now is to have the grand total by country as well:

rflora_0-1613740001807.png

Essentially i should have "1" in the blue arrows and "3" in the red arrows

 

Hi @rflora

Do the Test1... Test3 come from another hierarchy column (assume it is called "Test") in your table? If so, try below measure:

New measure 3 = 
VAR unirows =
    CALCULATE (
        DISTINCTCOUNT ( 'TestData'[Value] ),
        FILTER ( 'TestData', NOT ( ISBLANK ( [Measure1] ) ) )
    )
RETURN
    IF (
        ISINSCOPE ( 'TestData'[Test] ) && ISINSCOPE ( 'TestData'[City] ),
        [Measure1],
        unirows
    )
022301.jpg
Kindly let me know if this works.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

Works perfectly! Thanks a mil.

amitchandak
Super User
Super User

@rflora , use is in scope and return formatted number, as datatype this measure is test

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.