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
yuhkao
Employee
Employee

Combo chart with calculation

Hi Expert

i need help for combining data and create combo chart. 

my raw data excel file contains two sheet. one is mutiple defect information, another is shipment with category and time.

i would like to create monthly combo chart in time as x-axis. column chart with total q'ty of defect in each month, line chart with failure rate[total defect/total shipment] in each month.

 

Sheet1

Category Date DefectType

Part1       201908    T1

Part2       201908    T1

Part3       201909    T2

Part4       201910    T1

 

Sheet2

Category  Date    Shipment

Part1       201908    1000

Part2       201908    500

Part3       201908    1000

Part4       201908    500

Part1       201909    1000

Part2       201909    500

Part3       201909    1000

Part4       201909    500

Part1       201910    1000

Part2       201910    500

Part3       201910    1000

Part4       201910    500

 

 

2 ACCEPTED SOLUTIONS
AiolosZhao
Memorable Member
Memorable Member

Hi @yuhkao ,

 

Hope below is what you want:

Combo chart with calculation.PNG

 

Measure 2 = CALCULATE(SUM(Sheet2[Shipment]),FILTER(Sheet2,NOT(ISBLANK(LOOKUPVALUE(Sheet1[DefectType],Sheet1[Category],Sheet2[Category],Sheet1[Date],Sheet2[Date])))))

Measure 3 = DIVIDE([Measure 2],CALCULATE(SUM(Sheet2[Shipment])))

 

Aiolos Zhao





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

Proud to be a Super User!




View solution in original post

Hi @yuhkao ,

 

Measure1 is not necessary for this chart I think, measure1 is :

Measure = CALCULATE(SUMX(Sheet1,LOOKUPVALUE(Sheet2[Shipment],Sheet2[Category],Sheet1[Category],Sheet2[Date],Sheet1[Date])))

 

Measure1 is created in the Sheet1 table,

 

Measure2 and Measure3 are created in the Sheet2 table.

 

Aiolos Zhao





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

Proud to be a Super User!




View solution in original post

9 REPLIES 9
AiolosZhao
Memorable Member
Memorable Member

Hi @yuhkao ,

 

Hope below is what you want:

Combo chart with calculation.PNG

 

Measure 2 = CALCULATE(SUM(Sheet2[Shipment]),FILTER(Sheet2,NOT(ISBLANK(LOOKUPVALUE(Sheet1[DefectType],Sheet1[Category],Sheet2[Category],Sheet1[Date],Sheet2[Date])))))

Measure 3 = DIVIDE([Measure 2],CALCULATE(SUM(Sheet2[Shipment])))

 

Aiolos Zhao





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

Proud to be a Super User!




@AiolosZhao 

 

for measure 2, its not possible to input different table criteria after filter funtion. it shows gray text. 

@yuhkao 

 

Measure2 can be created in Sheet2 table like I said above with no errors, please try

 

Aiolos Zhao

 

Combo chart with calculation 2.PNG





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

Proud to be a Super User!




@AiolosZhao  sorry for bother again. does original data must be table or sheet is okay? 

@yuhkao I think both are okay, the data source can be table, sheet, database I think.

 

Aiolos Zhao





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

Proud to be a Super User!




@AiolosZhao 

sorry again, got stuck in another part.

As I create combo chart with date as shared axis, with matching two criteria of category and date as condition to build up the chart. 

line as for rate=[count of category]/[sum of shipment] 

column chart is count of defect type which is from sheet1

 

problem:

for the shared axis of combo chart, using sheet1 date or sheet2 date? i found one i select either of them., one of line or column data stays constant..... seems date is not share for both sheet1/sheet2 data.  how can i solve it? 

 

 

@yuhkao 

 

Yes, if there is no relationship between these two tables, the date won't be shared.

 

Please try to use the "manage relationship" in the "Modeling" tab to create the relationship between sheet1 and sheet2.

 

Aiolos Zhao





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

Proud to be a Super User!




@AiolosZhao  what is measure 1 formula? still confused 

Hi @yuhkao ,

 

Measure1 is not necessary for this chart I think, measure1 is :

Measure = CALCULATE(SUMX(Sheet1,LOOKUPVALUE(Sheet2[Shipment],Sheet2[Category],Sheet1[Category],Sheet2[Date],Sheet1[Date])))

 

Measure1 is created in the Sheet1 table,

 

Measure2 and Measure3 are created in the Sheet2 table.

 

Aiolos Zhao





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.