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 Team,
I have a column in my sales table called Total Sales, the table has a data type of decimal.
This column has postive and negative values, the positive values represent sales numbers, the negative values represent the credit numbers that we send back to customers.
I want to create a column where I can only show the negative values from the total sales column ONLY and then create another column where I can calculate percentage of credit which is basically a division of Credit values over Sales values.
Any help is highly appreciated, thanks a lot
Thanks @vanessafvg, really appreciate your assistance. Problem is that the credit percentage is not showing proper results unfortunately, your logic makes perfect sense to me. It seems like the variable credit is not showing proper numbers so thats why its throwing the credit percentage off. How I test my numbers is by simply only showing negative values straight from the total sales column found in the sales table and the numbers I get is not matching with the credit variable. Is there an other way we can pull negative values from the total sales column without the use of variables? For instance by using conditions such as If statement?
percentage of credit =
var credit= calculate(sum(sales), sales < 0)
var sales= calculate(sum(sales), sales > 0)
var result = divide(credit, sales,0)
return result
Proud to be a Super User!
Any luck with trying to create this logic using If function please?
it also depends on what result you want, you might need to convert the credit into an absolute first. (ie postiive number)
percentage of credit =
var credit= calculate(sum(sales), sales < 0)
var sales= calculate(sum(sales), sales > 0)
var result = divide(abs(credit), sales,0)
return result
Proud to be a Super User!
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |