Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
Solved! Go to Solution.
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.
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
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.
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |