Forum Discussion
Calculated column rows do not return values for all rows
Hi,
I have 2 tables - Currency & Sales and they are connected by many to many relationship.
I have created a calculated column in Sales table, and it returns value for only one condition, where the period is equal to '20214'. For other rows, where the period is <> 20214, the values are blank. Below is my table structure & the DAX
Table Currency -
Field LCurrency FCurrency FXRate Type Period
yyyym EUr GBp 0.8545 AVRS 20214
USd GBp 1.1684 AVRS 20214
JPy Eur 0.8808 RNMJ 20214
Table Sales
Field Item Currency Sales Period Calculated Column Value
yyyym 0123 USd 10000 20214 8558.712
4567 USd 8000 20213 BLANK, value should be 6846.97
8787 EUr 2000 20216 BLANK, value should be 2340.55
DAX is:
'SALES'[Sales] *
DIVIDE(1,
CALCULATE(
FIRSTNONBLANK('Currency'[FXRate], TRUE() ),
FILTER(
'Currency'
'Currency'[LCurrency] = 'Sales'[Currency] &&
'Currency'[FCurrency] = "GBP" &&
'Currency'[Type] = "AVRS" &&
'Currency'[Period] = "20214")
)
)
Appreciate your help on this please.
Thanks,
- Anonymous4 years ago
Hi Sai_Alkesh ,
Please remove any relationship between currency and sales table, and you can get the expected result...
Remove relationship
Best Regards
8 Replies
- Sai_AlkeshHelper II
- amitchandakSuper User
Sai_Alkesh , If all rate rae there then you should compare period with period
'SALES'[Sales] *
DIVIDE(1,
CALCULATE(
FIRSTNONBLANK('Currency'[FXRate], TRUE() ),
FILTER(
'Currency'
'Currency'[LCurrency] = 'Sales'[Currency] &&
'Currency'[FCurrency] = "GBP" &&
'Currency'[Type] = 'sales'[Type] &&
'Currency'[Period] = sales[Period])
)
)
- Sai_AlkeshHelper II
amitchandak - it still gives the same result. The reason i have the period in the filter clause is, 'cos i want to get the inverse value of FX rate which is for that period. Once i get that rate, i want to multiply the sales from Sales table with this derived rate.
In the calculated column of Sales table, it shows me the result of the derived value, however it only shows where the period in sales table is '20214'