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, I have a measure DAX similar to this example:
Distance exceeded =
VAR distance = MAX(MyTable[Distance from previous])
VAR maxDistance = [Max distance]
VAR fraction = distance / maxDistance
RETURN fraction > 1
I tried putting this measure to my table visual, but the results don't make sense to me. For example, if on that row distance = 15000 and maxDistance = 10000 and I do RETURN fraction, I get 1.5 on the table. This fraction value looks ok on every row. But if I do RETURN fraction > 1, the table shows FALSE for every row, even if the fraction is actually >1. Other observation is that if I try to do RETURN fraction + 1, the table always shows 1.00.
What could be causing this behaviour? I would expect that if for example value of fraction variable is 2.3 and I do RETURN fraction + 1, table would show 3.3. I've tried to use CONVERT and ROUND everywhere but that doesn't seem to make any difference.
Solved! Go to Solution.
Hi. Yes my issue is resolved, the reason was that there was a very obvious calculation error in my measure, which I failed to notice due to time pressure. Also the reason I was getting weird values for the calculation was because I put this measure in a table (for debugging purpose), and that messed up the context. So basically my whole question is not really valid...
Hi @JKoivu ,
Is your issue solved?
Hi. Yes my issue is resolved, the reason was that there was a very obvious calculation error in my measure, which I failed to notice due to time pressure. Also the reason I was getting weird values for the calculation was because I put this measure in a table (for debugging purpose), and that messed up the context. So basically my whole question is not really valid...
Hi @JKoivu,
Glad to hear that,could you pls mark the reply as answered to close it?
Much appreciated.
@JKoivu , You need to correct your return statement
Distance exceeded =
VAR distance = MAX(MyTable[Distance from previous])
VAR maxDistance = [Max distance]
VAR fraction = distance / maxDistance
RETURN if( fraction > 1,[fraction]+1,[fraction])
@JKoivu
I am not reading the logic here, are you trying to get something like this. Can you explain your desired results if this is not the solution?
Distance exceeded =
VAR distance = 15000//MAX(MyTable[Distance from previous])
VAR maxDistance = 10000 //[Max distance]
VAR fraction = distance / maxDistance
RETURN
if(fraction > 1 , fraction + 1, fraction)
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
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 | |
97 | |
80 | |
67 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |