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.
Something strange is happening with my measure and I can't figure out why / what I need to do to make it work properly. Any advice would be great. I have a table, simplified below, and on the page there is a slicer for country. I am using a table visual to display the items for the selected country and also price, with the correct currency.
Country | Item | Price | Currency |
1 | AAA | 100 | GBP |
1 | BBB | 200 | GBP |
2 | CCC | 300 | USD |
2 | DDD | 200 | USD |
2 | EEE | 100 | USD |
My measure currently looks like this, where Measure1 is a simple average(price) measure. When I add this measure as a field to the table visual it displays the items from all countries, just with blanks in this column.
Measure2= VAR SelectedCountry = SELECTEDVALUE(Table 1[country]) RETURN IF(SelectedCountry=1,Format([Measure1],"£0.00"),Format([Measure1], "$0.00"))
I have tried using various filters but have had no success. Any ideas? 🙂
Solved! Go to Solution.
I'm not quite sure I understand. You want to only return the average if the price is not blank? If that's the case, you can either use a visual filter or inside your measure do something like this:
CALCULATE(AVERAGE(Table1[Price]), Table1[Price] <> BLANK())
It's working for me:
MyMeasure = var avgPrice = AVERAGE(Table1[Price]) var SelectCountry = SELECTEDVALUE(Table1[Country]) Return IF(SelectCountry = 1, FORMAT(avgPrice, "£0.00"), FORMAT(avgPrice, "$0.00"))
@hnguy71 thanks for helping 🙂 unfortunately it's still not working for me, having tried a few different things. The only reason I can think of is because of blanks in my Price column?
I'm not quite sure I understand. You want to only return the average if the price is not blank? If that's the case, you can either use a visual filter or inside your measure do something like this:
CALCULATE(AVERAGE(Table1[Price]), Table1[Price] <> BLANK())
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |