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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dinesharivalaga
Post Patron
Post Patron

Margin % calculation with same name and multiple rows

Hi Experts,

I am working on revenue margin calculation in my dashboard.

But it is not giving the result as expected and it is summing the % (YTD CM% --> 45+53 = 98% for CM%) --> Data source from SP list

dinesharivalaga_0-1729781040743.png

When multiple rows with same account names listed --> in that case revenue will summing up and CM% calculation mentioned below.

Actual revenue = Total YTD revenue * YTD CM%

CM % = Total Actual Revenue / Total YTD Revenue 
As per the data , 276909.78 / 565122 = 48%

So 48% will be the output on both CM% rows

 

DAX i have tried :

CM % = CALCULATE(DIVIDE([Total Actual Revenue],[Total YTD Revenue],0),ALLEXCEPT('Test Delivery Updates','Test Delivery Updates'[Account Name]))

                   

please help me to achieve this.

 

Thanks

DK

5 REPLIES 5
Anonymous
Not applicable

Hi @dinesharivalaga 

 

Please correct me if I've misunderstood. [Total YTD Revenue] seems to be the measure you created, try the calculated column instead.

If it doesn't work, please provide some sample data and describe all the meaures or columns you used.

 

I tested this with simple data and when I used the measure, the values for the same account name would not aggregate, changing to a calculated column gives the desired result..

 

Total YTD Revenue(measure) = CALCULATE(SUM('Test Delivery Updates'[YTD Revenue]), ALLEXCEPT('Test Delivery Updates','Test Delivery Updates'[Account Name]))
CM % = CALCULATE(DIVIDE([Total Actual Revenue],[Total YTD Revenue(measure)],0),ALLEXCEPT('Test Delivery Updates','Test Delivery Updates'[Account Name]))

 

vxianjtanmsft_0-1729842468774.png

 

Total YTD Revenue(calculate column) = CALCULATE(SUM('Test Delivery Updates'[YTD Revenue]), ALLEXCEPT('Test Delivery Updates', 'Test Delivery Updates'[Account Name]))
_CM% = 
CALCULATE(
    DIVIDE(
        [Total Actual Revenue],
        CALCULATE(SUM('Test Delivery Updates'[Total YTD Revenue(calculate column)]), ALLEXCEPT('Test Delivery Updates', 'Test Delivery Updates'[Account Name])),
        0
    ),
    ALLEXCEPT('Test Delivery Updates', 'Test Delivery Updates'[Account Name])
)

 

vxianjtanmsft_1-1729842566044.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.

@Anonymous  Thanks for your solution .. here the challenge is we have done an unpivot column method in few selected columns , so after that all the accounts were duplicated (27 rows each) . so i have used DISTINCT in the "Total YTD Revenue" measure to filter the single unique revenue numbers .

 

In this case we have same values for both the accounts (same account name also) , so that it is not summing up and giving unique values. only different thing in this each row is "Offer Type" column.

dinesharivalaga_0-1729852261807.png

Existing DAX :

Total YTD Revenue = SUMX(VALUES('Test Delivery Updates'[YTD Revenue]),CALCULATE(DISTINCT('Test Delivery Updates'[YTD Revenue])))

Here cannot able to use ALLEXCEPT like your code..
Please advise..
 
Anonymous
Not applicable

Hi @dinesharivalaga 

 

Could you please provide some sample data that maintains the same data structure? And describe which columns you are selecting for the unpivot operation.

Thank you in advance for your cooperation.

 

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.

Selva-Salimi
Super User
Super User

Hi @dinesharivalaga 

 

I think you should update your DAX as follows:

 

CM % = DIVIDE(calculate([Total Actual Revenue],ALLEXCEPT('Test Delivery Updates','Test Delivery Updates'[Account Name])) , calculate([Total YTD Revenue] ,ALLEXCEPT('Test Delivery Updates','Test Delivery Updates'[Account Name]),0)

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.

@Selva-Salimi  Thanks for your response 🙂

I didn't see any changes on the results , it is still same 98% 😞
Total YTD Revenue values are same on both rows so that it is not summing up .
In this case denominator is not summed up each other , it is just showing unique values.

 

dinesharivalaga_1-1729832151947.png

 

dinesharivalaga_0-1729831634303.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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