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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
GeekyT
Helper II
Helper II

Summing one column by another

Hi,

I am trying to create a pie chart showing the amount of down time each production line has had in our factory in a given time period. Each line has a number of machines in it and the downtime is recorded for each machine individually therefore I want to sum the down time for the whole production line for the period of time chosen.

in Excel this would look like:

 

GeekyT_0-1612799035571.png

I have tried to roll-up the machine numbers but that hasn't worked and I'm still either getting the individual down time per machine OR I'm getting the sum of all down time for the whole period on all machines.

Is there a way to sum the down time by production line and show it in a pie chart? Or if not a pie chart, another visual?

1 ACCEPTED SOLUTION

Hi @GeekyT,

Yes, it is possible.
You can add a calculated column not your table to extract the left part of 'Asset Number', then you can use it on the pie chart and change the category field and these values will be auto aggregated.

98.gif

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

8 REPLIES 8
v-shex-msft
Community Support
Community Support

Hi @GeekyT,

Did this 'prod- mach' field really exist in your table? If not, you can create a calculated column to contact these field values and use it in the pie as category and value with value field with summary mode 'sum'.
Rgards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft Using a column has allowed me to put the asset number into the 'Legend' column, so thank you for suggesting that. However my problem is that it's now summing all my Down Time for all machines into a single number on my pie chart.

Perhaps I have used the wrong DAX to create my column? Here's what I did. This DAX was meant to roll up the machine numbers to the production line level (by removing the last 4 digits), so I could see the down time for each production line:
Asset No(3) = Switch( true(),
CONTAINSSTRING(MIN('wkaw'[assetno]),"ASSY"), LEFT(MIN('wkaw'[assetno]), 11),
CONTAINSSTRING(MIN('wkaw'[assetno]),"PRINT"), LEFT(MIN('wkaw'[assetno]), 12))

This is what I'm seeing:

Screenshot 2021-02-10 093221.jpg

Hi @GeekyT,

Can please share some dummy data with a similar data structure and expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft My apologies, I should have done that sooner, here's what my data looks like raw. The data in columns A & B are the raw down time data for our individual machines, in columns D & E I have totalled the down time for each machine. But it's columns G & H I want to replicate in BI. Here I have totalled the down time for each whole production line and put that into my pie chart:

Screenshot 2021-02-11 102650.jpg

Is this possible?

Thanks.

Hi @GeekyT,

Yes, it is possible.
You can add a calculated column not your table to extract the left part of 'Asset Number', then you can use it on the pie chart and change the category field and these values will be auto aggregated.

98.gif

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft Thanks for the solution, with a little research on how to build a hierarchy from my machine numbers I was able to get the pie chart to work correctly.

@v-shex-msftYes, I tried that, but rather than a calculated column I used a measure as I needed to remove the last few digits of the asset number. However when I try to put the measure into the 'Legend' field it won't accept it. Can you add measures to the Legend field?

 

negi007
Community Champion
Community Champion

@GeekyT I understand your downtime in hours, so in powerbi you may need to convert hours which is in time format to actual minutes or hours to arrive at sum of downtime by machin

 

Time (in hours) = (HOUR('Machin downtime'[Down Time])*60+MINUTE('Machin downtime'[Down Time]))/60
negi007_1-1612800499809.png

below is the output you are expecting

 

 
negi007_2-1612800520659.png

 

 

 
 



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



Proud to be a Super User!


Follow me on linkedin

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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