Forum Discussion
Dynamic field names in mesures
- 6 years ago
Hi Anonymous ,
Sorry for our delay in response, but it does not support to calculate dynamic formula/field in measure, but we can use "unpivot" in power query editor to meet your requirement:
If you do not want to change the construction of data, we can use switch to calculate for each area:
Sales = SUMX ( DISTINCT ( Country[Country] ), SWITCH ( [Country], "USA", SUM ( Sales[Sales_USA] ), "BRA", SUM ( Sales[Sales_BRA] ), "CAN", SUM ( Sales[Sales_CAN] ), "JPN", SUM ( Sales[Sales_JPN] ) ) )
By the way, PBIX file as attached.
Best regards,
Hi Ashish_Mathur , I took the the above data just an example to explain the scenario but in reality the data and the usecase is different and we can't change the data foramt for various reasons.
I've created a measure as below.
- v-lid-msft6 years ago
Community Support
Hi Anonymous ,
Sorry for our delay in response, but it does not support to calculate dynamic formula/field in measure, but we can use "unpivot" in power query editor to meet your requirement:
If you do not want to change the construction of data, we can use switch to calculate for each area:
Sales = SUMX ( DISTINCT ( Country[Country] ), SWITCH ( [Country], "USA", SUM ( Sales[Sales_USA] ), "BRA", SUM ( Sales[Sales_BRA] ), "CAN", SUM ( Sales[Sales_CAN] ), "JPN", SUM ( Sales[Sales_JPN] ) ) )
By the way, PBIX file as attached.
Best regards,