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.
My question is simple: How do I save a percentage as a variable in DAX? In order to count Sharpe's ratio I'd need to perform a following calculation:
Profit - (-0,25%) / volatility. How do I save the -0,25% as a variable? Only way I figured was to make a measure containing -0,25 and then change the data type to percentage.
Thank you!
Solved! Go to Solution.
I think you need to understand a bit more about how percentages are saved, so here we go.
When a percentage is saved in Power BI it is saved as a decimal number (0,75) = 75%. When you select the modeling as percentage power bi is very smart and knows you want to see 75%. So it does that for you.
When calculating tho you would (most of the cases) use 0.75. Because if i want to calculate 75% of 1000 i can do 1000*0.75=750.
hence he said you might want to do it *100. (0.75*100=75%)
So to get back to your initial question when you save a measure with -0.25 and make it a percentage. The percentage is -25%. Calulating with -0.25% would be -0.0025.
i hope this helps 🙂
Quality over Quantity
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |