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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
muchtamo
New Member

Total column matrix are incorrect

Mohamad Muchtar Mohamad Muchtar 5 minutes ago Hello , I've problem with my dax formula, column totals are not equal to monthly total Forecast1 = if( CALCULATE(sum('dbprojects tbl_t_project_impact'[actual]))=0, SUMX('dbprojects tbl_t_project_impact',CALCULATE(SUM('dbprojects tbl_t_project_impact'[plan]))), sumx(values('dbprojects tbl_t_project_impact'),CALCULATE(SUM('dbprojects tbl_t_project_impact'[actual])) ))
3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @muchtamo ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

v-stephen-msft
Community Support
Community Support

Hi @muchtamo ,

 

We usually use the SUMX function or the HASONEVALUE function to solve the problem of incorrect matrix Subtotals.

Try this

Total Actuals =
SUM ( 'dbprojects tbl_t_project_impact'[actual] ) 
Total Plan = 
SUM ( 'dbprojects tbl_t_project_impact'[plan] )
Forecast1  = 
IF (
     [Total Actuals] = 0,
    SUMX (
        'dbprojects tbl_t_project_impact',
        [Total Plan]
    ),
    SUMX (
         'dbprojects tbl_t_project_impact' ,
        [Total Actuals]
    )
)

 

Reference: DAX – Subtotals and Grand Totals That Add Up “Correctly”

 

Best Regards,

Stephen Tao

 

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

 

 

rajulshah
Super User
Super User

Hello @muchtamo ,

You would need to create 3 measures as follows:

Total Actuals =
   CALCULATE ( SUM ( 'dbprojects tbl_t_project_impact'[actual] ) )

Total Plan = 
   CALCULATE ( SUM ( 'dbprojects tbl_t_project_impact'[plan] )

Total Monthly Forecast = 
VAR ActualSum = [Total Actuals]
VAR PlanSum = [Total Plan]
RETURN
IF (
    ActualSum  = 0,
    SUMX (
        'dbprojects tbl_t_project_impact',
        [Total Plan]
    ),
    SUMX (
        VALUES ( 'dbprojects tbl_t_project_impact' ),
        [Total Actuals]
    )
)

 

And then plot the last measure in the chart and see the results.
Please let me know if this didn't work.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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