I need to create measure that compares Currency from different tables. Simple if one column is empty then take data from other.
Material
Material no | Name |
---|---|
1234 | Mat 1 |
5678 | Mat 2 |
1290 | Mat 3 |
Budget
Material no | Currency |
---|---|
1234 | USD |
5678 | |
1290 | EUR |
JIRA
Material no | Currency |
---|---|
1234 | |
5678 | EUR |
1290 | EUR |
Expected result
Material no | Currency |
---|---|
1234 | USD |
5678 | EUR |
1290 | EUR |
I've created measure
Miara-test =
VAR Purchase_filter = MAXX('Budget','Budget'[Currency])
RETURN IF( ISBLANK(Purchase_filter)) || Purchase_filter = "", MAXX(JIRA,JIRA[Currency]), MAXX('Budget','Budget'[Currency]))
Due to whatever reason, I've received table that returns only currency in case they're same in both source data
Material no | Currency |
---|---|
1234 | |
5678 | |
1290 | EUR |
Try this Measure:
Currency_Measure =
VAR BudgetCurrency = MINX(Budget, [Currency]) //since there is a relationship from Material to Budget, this gets the related value.
VAR JiraCurrency = MINX(JIRA, [Currency]) //gets related value
RETURN SWITCH(TRUE()
, BudgetCurrency = BLANK(), JiraCurrency
, JiraCurrency = BLANK(), BudgetCurrency
, JiraCurrency = BudgetCurrency, JiraCurrency //doesn't matter which one we output
, "" //if they both have data but are different, output blank for now
)
Example Output:
Material 1111
is an example where both the Currencies are different nonblank values.
Data Model:
The Material
table is related to both Budget
and Jira
but the Material no
column.