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

Calculating totals after unpivoting

Hi, new to Power Bi, so probably a noob question. 

In my data table, I have unique instances (say, "Fruits" tasted) and a comma-delimeted, multiple value column ("Comment") which I needed to unpivot. 

 

FoodPriceComment
Pizza5instaworthy
Pasta4good
Apples3bad, ugly

Howerver, this messes up the visualizations displaying, say, the total price, or the average price, of foods tasted. 

 

FoodPriceComment
Pizza5instaworthy
Pasta4good
Apples3bad
Apples3ugly

How can I have my visualizations display the correct total price (12, not 15) and average price (4, not 3,75)?

I undestand that Wrong Totals after unpivoting some columns deals with the same issue, but I am not sure how to apply that to my visuals. 

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@LauriL 

 

Try this MEASURE

Measure =
SUMX ( VALUES ( Table1[Food] ), CALCULATE ( AVERAGE ( Table1[Price] ) ) )

Regards
Zubair

Please try my custom visuals

View solution in original post

v-juanli-msft
Community Support
Community Support

Hi @LauriL 

You could create measures as Zubair_Muhammad suggested

AVERAGE = AVERAGEX(VALUES(Sheet3[Food]),CALCULATE(AVERAGE(Sheet3[Price])))

SUM TOTAL = SUMX(VALUES(Sheet3[Food]),CALCULATE(AVERAGE(Sheet3[Price])))

Capture5.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

hi @LauriL ,

 

follow my screenshots, then you can easily understanding how can I convert your solution.

1. see this is your data

 

Capture.JPG

 

2. Press column and go to the split column option and then click on By Delimiter option. 

Capture1.JPG

 

3. select the options like this and go to advanced options, change it Rows wise and quote character is none. 

Capture2.JPG

 

4. Final result are getting like this,

Capture4.JPG

 

thanks & regards,

Naveen

v-juanli-msft
Community Support
Community Support

Hi @LauriL 

You could create measures as Zubair_Muhammad suggested

AVERAGE = AVERAGEX(VALUES(Sheet3[Food]),CALCULATE(AVERAGE(Sheet3[Price])))

SUM TOTAL = SUMX(VALUES(Sheet3[Food]),CALCULATE(AVERAGE(Sheet3[Price])))

Capture5.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Zubair_Muhammad
Community Champion
Community Champion

@LauriL 

 

Try this MEASURE

Measure =
SUMX ( VALUES ( Table1[Food] ), CALCULATE ( AVERAGE ( Table1[Price] ) ) )

Regards
Zubair

Please try my custom visuals

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.