Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi guys,
I hope you all are doing fine.
I please need your help in this. I have made a sample table for your reference.
So like shown in this table, I have various customers with both positive and negative invoice amounts. Category B has all the positive values and blank represent negative values. I want to calculate the percentage by diving all the positive values of a particular customer by all the negative values of that customer. We can divide these values on the basis of category but I don't know how to do it.
Please let me know If you have some other questions regarding the explanation.
Thank you very much in advance.
Regards
Solved! Go to Solution.
Hi @gupta_diksha ,
Here are the steps you can follow:
1. Create calculated column.
flag =
var _positive=
CALCULATE(SUM('Table'[Invoice_amounts]),FILTER(ALL('Table'),'Table'[Category]="B"&&'Table'[Customer name]=EARLIER('Table'[Customer name])))
var _negative=
CALCULATE(SUM('Table'[Invoice_amounts]),FILTER(ALL('Table'),'Table'[Category]=BLANK()&&'Table'[Customer name]=EARLIER('Table'[Customer name])))
return
DIVIDE(_positive,_negative)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @gupta_diksha ,
Here are the steps you can follow:
1. Create calculated column.
flag =
var _positive=
CALCULATE(SUM('Table'[Invoice_amounts]),FILTER(ALL('Table'),'Table'[Category]="B"&&'Table'[Customer name]=EARLIER('Table'[Customer name])))
var _negative=
CALCULATE(SUM('Table'[Invoice_amounts]),FILTER(ALL('Table'),'Table'[Category]=BLANK()&&'Table'[Customer name]=EARLIER('Table'[Customer name])))
return
DIVIDE(_positive,_negative)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@gupta_diksha , Try a measure like
Divide(sumx(filter(Table, Table[Invoice Amount] <0), abs([Invoice Amount])), sumx(filter(Table, Table[Invoice Amount] >0), [Invoice Amount]))
or
averagex(values(Table[Customer Number]), Divide(sumx(filter(Table, Table[Invoice Amount] <0), abs([Invoice Amount])), sumx(filter(Table, Table[Invoice Amount] >0), [Invoice Amount])))
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
60 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |