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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SAPpowerbi
Helper II
Helper II

Power Bi pivot in power query for percentage calculation

Hi Team ,

I need to do pivot on below transformation ,please check source my output and expected output and help me for the same.

data information -

SL is A /B /C and clinet name is CG and TCS based on this i need to convert to pivot this is just a dummy data .

 

Source data -

SLClinet namedate Value
ACGJan-2310
BCGJan-2320
CCGJan-2330
ATCSJan-2340
BTCSJan-2350
CTCSJan-2360
ACGFeb-2310
BCGFeb-2320
CCGFeb-2330
ATCSFeb-2340
BTCSFeb-2350
CTCSFeb-2360

 

 

 

Output which I get - After pivot i get below output which is not expcted .

Clinet NamedateABC
CGJan-2310NullNull
TCSJan-2340NullNull
CG23-Feb10NullNull
TCS23-Feb40NullNull
CGJan-23Null20Null
TCSJan-23Null50Null
CG23-FebNull20Null
TCS23-FebNull50Null
CGJan-23NullNull30
TCSJan-23NullNull60
CG23-FebNullNull30
TCS23-FebNullNull60

 

 

Expected Output - I need ouput like below table -

 

Clinet NamedateABC
CGJan-23102030
TCSJan-23405060
CG23-Feb102030
TCS23-Feb405060

 

SO based on above ouput i will do calculated column like A/ (A+B+C)= Peracnatge .
Please help me to achive above output .

Thanks in advance .

1 ACCEPTED SOLUTION

Hi @SAPpowerbi ,

 

I think you can click on [SL] column and then select [Value] column in Pivot function.

Result is as below.

vrzhoumsft_0-1698132164057.png

You can download my sample file to learn more details.

 

Best Regards,
Rico Zhou

 

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

8 REPLIES 8
HotChilli
Super User
Super User

The code looks absolutely fine.

However there are extra columns in the real data which are not in the sample further above.

Can you provide a picture (all columns please) or a realistic data sample of rows which you expect to Group but are not ?

ok Sure , thank you for the reply

Hi @SAPpowerbi ,

 

I think you can click on [SL] column and then select [Value] column in Pivot function.

Result is as below.

vrzhoumsft_0-1698132164057.png

You can download my sample file to learn more details.

 

Best Regards,
Rico Zhou

 

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

 

 

HotChilli
Super User
Super User

I know it's sample data. I am explaining one possible reason why the Pivot has produced this result (which may be applicable to the original data).

--

Can you post the Advanced Editor code please?

SAPpowerbi_0-1697828908502.png

Please find above screenshot for your ref data look like this after pivot so M column values are showing now , but for C column once M column values are end then C column values are starting .

please help me .

 

-

HotChilli
Super User
Super User

It looks like the client names have spaces or special characters in them so they haven't grouped properly.

Can you Clean and Trim the columns before pivot please?

--

If it doesn't work, please post the Advanced Editor code and i'll have a look

Hi ,
Thank you for Qucik reply , This is just a dummy data which i put here as a refrance - i have a origanal  data with coorect format .

so please help me for the power BI pivot Transformarion .

thank you 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.