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

Combining multiple measures into one column chart.

Hi, 

I have an issue I have been struggling with. 

The case is: 

I am making a KPI report and want to measure Gross Profit per region divided by workforce per region in the different sectors.

 

For example, I have following DAX to calculate gross profit in sales in region AMS in 2021: 

GP 2021 AMS = calculate(SUMX('General Measures',[SUM Amount]), FILTER('Fact_Table','Fact_Table'[P&L Level 3] IN {"Product cogs", "Product revenue", "Service COGS", "Services revenue"}), ('Dim_Date'[Year] = "2021" ), (Fact_Table[Region u/ACON] = "AMS"))
 
This is divided into the following DAX to find workforce by AMS: 
Sales AMS 2021 = CALCULATE(sum('Workforce'[Workforce]), 'Workforce'[JC KEY] = "HC2000", 'dim_date'[Year] = "2022", Workforce[Region] = "AMS" ) --> This is later turned into average per month
 
So the question is: By doing this I need to create a significant amount of measures to find gross profit per region in 2021 and 2022, to measure differences. 
However, do someone know if I can write this DAX more efficiently and be able to visualize that data in one column chart? Now I have to use multiple column charts next to each other since it's different data fundament. 
 
Hope this made some sort of sense. Appreciate some help with this 🙂 

 

3 REPLIES 3
lukmtb08
Helper III
Helper III

You can use one Switch-measures in your visual. Within the Switch you can create a reference to your measures.

V-lianl-msft
Community Support
Community Support

Hi @herwet ,

 

You need to confirm the current context of your measure If you need to calculate all regions, you should consider adding fields to the visual to affect the context.


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

amitchandak
Super User
Super User

@herwet , I will use measure like

 

Sales AMS 2021 = CALCULATE(sum('Workforce'[Workforce]), 'Workforce'[JC KEY] = "HC2000",, Workforce[Region] = "AMS" , filter( 'dim_date' , 'dim_date'[Year] = max( 'dim_date'[Year]) ) )

 

example

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

You can also check calculation groups Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0 

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.