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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
ChristoNindyo
Advocate I
Advocate I

How to fix total in matrix

Hello experts,

May I ask how to fix total in this table ? 

 

ChristoNindyo_0-1739976633144.png

Values here I used measure:

_0_Visits2_Planned = IF(ISBLANK(VW_FACT_VISIT[_Planned2_TotalVisits]) || VW_FACT_VISIT[_Planned2_TotalVisits] = 0, 1, 0)
_Planned2_TotalVisits = IF(ISBLANK(SUM(VW_FACT_VISIT[_Visits_Planned])), 0, SUM(VW_FACT_VISIT[_Visits_Planned]))
_Visits_Planned = IF(VW_FACT_VISIT[VISIT_TYPE]="Planned",1,0)
 
Thank you!
 
 


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

Hi @ChristoNindyo 

 

Thanks Chew_WenJie for your positive response and great answer.


Agree with Chew_WenJie. The SUMX function iterates through each unique value in the 'Primary Resources TMR' column and applies IF logic to each value and then sums the results. This ensures that in the context of totaling rows and columns, the measure correctly calculates the value for each cell and summarizes it.
Modify your measure [_0_Visits2_Planned] as follows:

_0_Visits2_Planned = 
SUMX(
    VALUES(VW_FACT_VISIT[Primary Resources TMR]),
    IF(
        ISBLANK(VW_FACT_VISIT[_Planned2_TotalVisits]) || VW_FACT_VISIT[_Planned2_TotalVisits] = 0,
        1,
        0
    )
)

vxianjtanmsft_0-1740365997305.png

 

Best Regards,
Jarvis Tang
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-xianjtan-msft
Community Support
Community Support

Hi @ChristoNindyo 

 

Thanks Chew_WenJie for your positive response and great answer.


Agree with Chew_WenJie. The SUMX function iterates through each unique value in the 'Primary Resources TMR' column and applies IF logic to each value and then sums the results. This ensures that in the context of totaling rows and columns, the measure correctly calculates the value for each cell and summarizes it.
Modify your measure [_0_Visits2_Planned] as follows:

_0_Visits2_Planned = 
SUMX(
    VALUES(VW_FACT_VISIT[Primary Resources TMR]),
    IF(
        ISBLANK(VW_FACT_VISIT[_Planned2_TotalVisits]) || VW_FACT_VISIT[_Planned2_TotalVisits] = 0,
        1,
        0
    )
)

vxianjtanmsft_0-1740365997305.png

 

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

 

Chew_WenJie
Resolver III
Resolver III

 

The total is incorrect because you are using the IFELSE measure. Try creating another measure that references the existing DAX measure. For example:

= SUMX(VALUES('Primary Resources TMR'), _Visits_Planned)

This approach ensures the calculation correctly aggregates the values across all rows.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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