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
jima
New Member

Can I blend IF and SUMX?

I am struggling to manipulate some data, many "experts" in our business have tried but failed.

 

I want to present a matrix of data to show revenue and margin (%) for current YTD and  last Year to data. I want to drill into the varioud attributes to spot what the levers are.

 

My problem comes from the data coming in a single table, I get both profit YTD (amount) and revenue YTD figures (out of a busines objects service) in this single table, so revenue and profit both show as rows in the datatable. There are no reference fields to link row together other than the column attributes.

 

The source table looks like this, there are other fields on top of this, nothing unique but this should give the flavour, each row is aways either rev or margin with the other attributes.

 

ItemCountryGroupSectorActual YTDLast Year YTD
Meat RevenueUSA1Consumer1,000900
Dairy RevenueGB3Business9001,100
Finance RevenueUSA2Consumer450425
Hardware RevenueFR3Consumer125180
Meat ProfitUSA1Consumer350300
Dairy ProfitGB3Business450500
Finance ProfitUSA2Consumer150150
Hardware ProfitFR3Consumer3050
Finance ProfitFR2Business300310
Hardware ProfitUSA2Business600600
Finance RevenueFR2Business9251200
Hardware RevenueUSA2Business24002500
Meat ProfitGB2Consumer120130
Dairy ProfitUSA1Consumer150160
Meat RevenueGB2Consumer250260
Dairy RevenueUSA1Consumer750725

 

I want to be able to show this.....

 

  
 Actual YTDLast Year YTDActual YTDLast Year YTD
Meat1,2501,16037.6%37.1%
Dairy1,6501,82536.4%36.2%
Finance1,3751,62532.7%27.7%
Hardware2,5252,68025.0%23.5%
TOTAL6,8007,29031.6%29.8%

 

On the original data, I managed to create measures to calculate the profit percentages but I can only do a measure each for meat, dairy, finance or hardware. I can't then combine the measures in one table.

 

Can I make an if statement that has the sumx as an expression, so one of the row columns eg Dairy then determines the result in the corresponding columns of the same row?

 

Help appreciated, nobobdy so far has found a way around this.....

 

Thanks in advance

 

Jim

 

PS an obvious one is to change the whole data extract from the BO service, I want to see if it is doable without going down that road.

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @jima ,

 

I've created this file as an example: Download PBIX 

 

I hope it helps you.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

3 REPLIES 3
camargos88
Community Champion
Community Champion

Hi @jima ,

 

I've created this file as an example: Download PBIX 

 

I hope it helps you.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Hi Ricardo,

 

that will do the trick nicely, i can see now what you did, just came at it from a different (the better) direction. I need to do someting with one of the columns to work some other types but your solution works nicely, thanks very much.

camargos88
Community Champion
Community Champion

Hi @jima ,

 

I'm glad it worked.

 

Note that the key point is to split the column and work as a separated column, I splitted the column using Power Query.

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.

Top Solution Authors