cancel
Showing results for
Did you mean:
Frequent Visitor

Hiw to get percentage column

Hello, I have a table which shows sales, purchases, and profit (sales minus purchases) grouped by date column. Table is related to a different table which has site names. So by that i calculate how much each site spends and makes sales. What  I need is a new column which would show percentage of purchases against sales. The syntax would look something like sales minus purchases = profit divided by sales which is 100% and I need everything shown in %. Thank You

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

Re: Hiw to get percentage column

Hi @TomasPac ,

Assuming the table which shows sales, purchases, and profit is named Table1, and the table which has site names is named Table2.

Based on having created relationship between the two tables, and set the Cross filter direction as Both, which will treat these tables as a single table ,you can create column and measure like DAX below in Table1.

Column: profit =[sales] - [purchases]

Measure: percentage= DIVIDE (CALCULATE(SUM(Table1[profit]),FILTER(ALLSELECTED(Table2), Table2[site names] =MAX(Table2[site names]))), CALCULATE(SUM(Table1[profit]),FILTER(ALLSELECTED(Table2), Table2[site names] =MAX(Table2[site names]))))

Then click on the field [percentage] in Field pane, set it showed "%".

Best Regards,

Amy

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

2 REPLIES 2
Community Support Team

Re: Hiw to get percentage column

Hi @TomasPac ,

Assuming the table which shows sales, purchases, and profit is named Table1, and the table which has site names is named Table2.

Based on having created relationship between the two tables, and set the Cross filter direction as Both, which will treat these tables as a single table ,you can create column and measure like DAX below in Table1.

Column: profit =[sales] - [purchases]

Measure: percentage= DIVIDE (CALCULATE(SUM(Table1[profit]),FILTER(ALLSELECTED(Table2), Table2[site names] =MAX(Table2[site names]))), CALCULATE(SUM(Table1[profit]),FILTER(ALLSELECTED(Table2), Table2[site names] =MAX(Table2[site names]))))

Then click on the field [percentage] in Field pane, set it showed "%".

Best Regards,

Amy

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

Community Support Team

Re: Hiw to get percentage column

Hi  @TomasPac ,

Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

Best regards

Amy

Announcements

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!