Forum Discussion
Switching between column values issue
- 1 year ago
Hi charlotte_13
To dynamically switch between local currency and Euro values on your chart's x-axis based on the country slicer selection, you'll need a measure to count the selected countries. This measure uses COUNTROWS and FILTER to determine how many countries are currently chosen in the slicer. Next, modify your existing field parameter. Within the field parameter definition, incorporate an IF statement. This IF statement checks the value of the country count measure. If the count exceeds one, the field parameter should include the Euro price columns (e.g., "Price Incl. Discount (EUR)"). Otherwise, if only one or no countries are selected, the field parameter should default to the local currency price columns (e.g., "Price Incl. Discount"). Finally, use this modified field parameter as the source for your chart's x-axis. Now, the chart will automatically display Euro values when multiple countries are selected and local currency values when a single country or no countries are selected. Remember to adjust table and column names to match your data model. This allows for a dynamic currency display based on user interaction.
Also, try this DAX:
Selected Country Count = CALCULATE( COUNTROWS(DISTINCT('YourCountryTable'[CountryName])), FILTER( 'YourCountryTable', 'YourCountryTable'[CountryName] IN ALLSELECTED('YourCountryTable'[CountryName]) ) ) Field Parameter = IF( [Selected Country Count] > 1, { ("Price Incl. Discount (EUR)", 'YourDataTable'[Price_Euro_Incl_Discount]), ("Price Excl. Discount (EUR)", 'YourDataTable'[Price_Euro_Excl_Discount]) }, { ("Price Incl. Discount", 'YourDataTable'[Price_Local_Incl_Discount]), ("Price Excl. Discount", 'YourDataTable'[Price_Local_Excl_Discount]) } )
Thank you, but this will generate the sum of the prices, I'm interested in showing each individual price point on the x-axis, sometimes in euro, sometimes in local currency