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.
I have a fairly simple measure as follows, that outputs a number of two decimal places.
Output =
[Measure 1] - CALCULATE ( [Measure 1], DATEADD ( 'Calendar'[Date], -1, YEAR ) )
However, when I use this same thing in a bit of a more complicated context, it only returns an integer. No decimal places are shown. In my case, I am using it with the switch function:
Output =
SWITCH (
TRUE (),
VALUES ( 'TI Filter'[Calculation Type] ) = "Last Year",
[Measure 1]
- CALCULATE ( [Policy Returned %], DATEADD ( 'Calendar'[Date], -1, YEAR ) ),
VALUES ( 'TI Filter'[Calculation Type] ) = "Last Quarter",
[Measure 1]
- CALCULATE ( [Measure 1], DATEADD ( 'Calendar'[Date], -1, QUARTER ) ),
VALUES ( 'TI Filter'[Calculation Type] ) = "Last Month",
[Measure 1]
- CALCULATE ( [Measure 1], DATEADD ( 'Calendar'[Date], -1, MONTH ) )
)
Is there a reason why it does not return decimals when it is used with the switch function?
I also have another measure identical to the one above that returns an output with two decimals. Everything is exactly the same, but a `Measure 2` takes place of `Measure 1`. Measure 1 and Measure 2 are also calculated in the exact same manner. I just don't get why one returns decimals and the other does not.
I also tried using the FORMAT function, but my bar chart errors out when it is used.
Solved! Go to Solution.
Still not really sure what was happening, but I fixed it. I just played with the visual and measure.. deleting them both and putting them back in and now it's working fine. Measure is completely the same, I literally just copied the same expression into another measure. Weird but it's solved now!
Still not really sure what was happening, but I fixed it. I just played with the visual and measure.. deleting them both and putting them back in and now it's working fine. Measure is completely the same, I literally just copied the same expression into another measure. Weird but it's solved now!
@markmess77 , Not very clear.
When you are using these measures in Switch You can multiply them with 1.0 , Also make sure the data type of output is decimal
also , you might have to use max ( 'TI Filter'[Calculation Type] ) = "Last Year"
in place of values( 'TI Filter'[Calculation Type] ) = "Last Year"
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 |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |