Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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])))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
137 | |
105 | |
104 | |
80 | |
63 |