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
Gisela
Helper I
Helper I

Adding a column which calculates % of the two other columns

Sample_data_for_Power_BI_forum.png

Hi, I am new at PowerBI and could not find an answer to this probably easy question.

 

I have the table above

I want to add a column which show the % of "Ttl rcvd new"/"Total sent"

 

"Ttl rcvd new" & "Total sent" are  from different excel sheets

I have tried to add a measure to calculate the % but 1/ I don't know where to add the measure 2/ i get an error or it just showed 100% for both.

 

How can I add the % column?

 

Thank you,

Gisela

 

 

 

Sample_data_for_Power_BI_forum2.png

1 ACCEPTED SOLUTION
12 REPLIES 12
SivaMani
Resident Rockstar
Resident Rockstar

Hi @Gisela,

 

Create a calculated column with divide function,

 

% Column = Divide(Ttl rcvd new,Total sent)

Power_BI_calculated_column.png

 

hi @SivaMani,

 

thank you for your quick response. I am very new to this so couldn't figure it out. Here is what I did:

 

I added a calculated column as per above but the %s are not correct. In the table, I have "Total sent" but that one is not showing up as an option too choose in my calculated column so I used Ttl sent new instead: Ttl sent new = CALCULATE(COUNT(Sent[Survey type]))

 

I changed the "SHOW VALUE AS" to "Percent of grand total" but maybe that is not correct? i don't know where the 78.46% is coming from... I tried both SUM and COUNT but none give correct %. The first one should be 367/906 = 40.50%

 

This is the measure behind the "Ttl rcvd new": Ttl rcvd new = CALCULATE(COUNT(Rcvd[Survey #]))

This is the measure behind the "Ttl sent": Total sent = COUNT(Sent[Survey type])

 

I tried a few others and they gave the same result. 

I had this one first: Total rcvd = COUNT(Rcvd[Survey type])   but it doesn't show up when I tried to create the calculated column.

Another one I tried was: Ttl rcvd new2 = SUM(Rcvd[Survey type])

 

Power_BI_calculated_column2.png

 

 

I added the calculated column in the SENT table.

 

Power_BI_calculated_column3.png

@Gisela

Could please share some sample data of the tables?

sample pbix file would be better

THANK YOU.

 

I will test this now with my real data and if I have questions, I will let you know and otherwise, set it to solved.

 

I really, really appreciate the help.

 

Gisela

 

@Gisela,

 

It's my pleasure Smiley Happy .

Almost there, two more questions:

 

1. how do I display the number as a %. I.e. 54% instead of 0.54

2. The % in the TOTAL, show the total of the two numbers above (in your example, it shows 66.87% which is the total of 35.29% and 31.58% but i should be 12/26 = 18%, i.e. show 18%.

 

Thank you @SivaMani!

 

 

Hi @SivaMani

 

I finally managed to change it to show as % so that part is done.

 

1. SOLVED! how do I display the number as a %. I.e. 54% instead of 0.54

2. UNSOLVED: The % in the TOTAL, show the total of the two numbers above (in your example, it shows 66.87% which is the total of 35.29% and 31.58% but i should be 12/26 = 18%, i.e. show 18%.

 

 

@Gisela,

 

For that case,

 

You have to convert the calculated column as a measure.

 

Just create a calculated measure with same DAX.

 

 

Regards,

Siva

One more which I created in order to be able to properly create a relationship between the other two tables:

 

https://www.dropbox.com/s/vt1xsw1g46afpf3/Survey%20look%20up%20table%20sample%20data%20PBI.pbix?dl=0

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.