Forum Discussion
DAX
Hi,
I have the following "table 1" with sales data of different currencies ($ and USD):
I have a "table 2" (not related), with different conversion rates (TC) for the currencies used.
Example: 1 USD = 40 $
I need to create a calculated colummn, so that everytime I select a "TC" option on my report, the table 1 shows a "TOTAL USD" sales.
Example if TC=40, the result would be: (TOTAL MONTO USD)
I guess I must use RELATEDTABLE since my TC options are multiple. I tried the following but had no success.
- Anonymous5 years ago
Hi Anonymous ,
Does Table 2 contain only one field named TC? You can create a measure as below instead of a calculated column to get USD value base on the selected TC value dynamically.
Measure for TOTAL MONTO USD = VAR _tab = SUMMARIZE ( 'Table 1', 'Table 1'[MONEDA ($/USD)], "_USD", IF ( SELECTEDVALUE ( 'Table 1'[MONEDA ($/USD)] ) = "USD", SELECTEDVALUE ( 'Table 1'[MONTO (S/IVA)] ), DIVIDE ( SELECTEDVALUE ( 'Table 1'[MONTO (S/IVA)] ), SELECTEDVALUE ( 'Table 2'[TC] ), 0 ) ) ) RETURN SUMX ( _tab, [_USD] )If the above one is not applicable for your scenario, please provide your expected result with more details. Thank you.
Best Regards
1 Reply
- AnonymousNot applicable
Hi Anonymous ,
Does Table 2 contain only one field named TC? You can create a measure as below instead of a calculated column to get USD value base on the selected TC value dynamically.
Measure for TOTAL MONTO USD = VAR _tab = SUMMARIZE ( 'Table 1', 'Table 1'[MONEDA ($/USD)], "_USD", IF ( SELECTEDVALUE ( 'Table 1'[MONEDA ($/USD)] ) = "USD", SELECTEDVALUE ( 'Table 1'[MONTO (S/IVA)] ), DIVIDE ( SELECTEDVALUE ( 'Table 1'[MONTO (S/IVA)] ), SELECTEDVALUE ( 'Table 2'[TC] ), 0 ) ) ) RETURN SUMX ( _tab, [_USD] )If the above one is not applicable for your scenario, please provide your expected result with more details. Thank you.
Best Regards