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

Calculate Columns based on value comparison between two columns

Hello Power BI community,

 

i am struggling to accompish the following task: I want to sum revenue data based on the company family using DAX (would know how to do it in excel vba, but that feels too dirty...)

I have already checked this post, but the described solution is insufficient for my case.

E.G. I have the following data

company name    company family    revenue

comp a                 compfam a           100

comp b                 compfam b          200

comp c                 compfam a           200

 

and i already created a table with the distinct values from "company family"
company family     revenue

compfam a
compfam b

 

what i tried is

revenue = CALCULATE(SUM('Table1'[revenue]); 'Table1'[company family] = 'Table2'[company family])

but this does not work because of language restrictions (only one column per fitler expression)?

Does anyone know how to accomplish this task?

 

 

Regards,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Raffael 

 

If you want to create a summary table for the family from the source table, you can try the below DAX. Do it in Modelling -> nw Table and use this DAX.

 

Sample2_Summary = SUMMARIZE(Sample2,Sample2[Company Family],"Total_Revenue",SUM(Sample2[Revenue]))

 

But, you dont need to create this table unless you need it specifically as you can get the revenue per family in easy way.

 

Create a measure Total_Revenue = SUM( Table1[Revenue]) and pull company family and this measure.

 

Let me know if you need any further details.

 

Thanks

Raj

 

Thanks

Raj

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Raffael 

 

If you want to create a summary table for the family from the source table, you can try the below DAX. Do it in Modelling -> nw Table and use this DAX.

 

Sample2_Summary = SUMMARIZE(Sample2,Sample2[Company Family],"Total_Revenue",SUM(Sample2[Revenue]))

 

But, you dont need to create this table unless you need it specifically as you can get the revenue per family in easy way.

 

Create a measure Total_Revenue = SUM( Table1[Revenue]) and pull company family and this measure.

 

Let me know if you need any further details.

 

Thanks

Raj

 

Thanks

Raj

Thanks Raj, worked like a charme.

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.