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
Jack09
Frequent Visitor

Sub Total is Not Displaying Correctly When Using Negative Value against particular Value

Hello,

 

I have the following scenario which is not working in DAX Calculations

 I have also mentioned the used Measure  below the following image.

 

Calculation Issue.png

 

Cancelled Counts =
VAR Total =
CALCULATE(
DISTINCTCOUNT('FinancialSummary'[ContactId]),
FILTER('FinancialSummary', 'FinancialSummary'[Membership Type] = 4)
) RETURN

IF(Total = BLANK(), 0, Total * -1)


General Counts =
VAR Total =
CALCULATE(
DISTINCTCOUNT('FinancialSummary'[ContactId]),
FILTER('FinancialSummary', 'FinancialSummary'[Membership Type] <> 4)
) RETURN

IF(Total = BLANK(), 0, Total)

Calculated Counts =
IF(SELECTEDVALUE('FinancialSummary'[Membership Type]) = 4, [Cancelled Counts], [General Counts])

 

 

Please provide the solution for this issue.

 

Thanks in Advance!

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

Hi @Jack09 ,

 

I suggest  you to create a new measure using the function of SUMX. Then the sub total will be calculated correctly.

Measure = SUMX(FinancialSummary, FinancialSummary[Cancelled Counts])

The following is my sample. You can reference to modify yours.

Measure = VAR a = SUM(Table1[Values])
return
IF(MAX(Table1[NSW]) = "Cancelled",a*-1,a)

Measure 2 = SUMX(Table1,Table1[Measure])

1.jpg

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
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

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @Jack09 ,

 

I suggest  you to create a new measure using the function of SUMX. Then the sub total will be calculated correctly.

Measure = SUMX(FinancialSummary, FinancialSummary[Cancelled Counts])

The following is my sample. You can reference to modify yours.

Measure = VAR a = SUM(Table1[Values])
return
IF(MAX(Table1[NSW]) = "Cancelled",a*-1,a)

Measure 2 = SUMX(Table1,Table1[Measure])

1.jpg

 

Best Regards,

Xue Ding

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

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

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.