Forum Discussion
Simple(?) Lookup not working
- Anonymous3 years ago
Hi Dudeman
You can create the following measure:
Measure = var _date = MAX('Invoice Date Table'[Date]) var _d=MAXX( FILTER(ALL('Alignment Table') ,'Alignment Table'[Date] = _date) , [SDayLM]) return CALCULATE(SUM('Invoice Table'[Sales]) , 'Invoice Date Table'[Date] = _d)Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You need a DAX measure for this, but not LOOKUPVALUE.
Here is the measure for Sales:
Sales SDayLM =
VAR _RelativeDates = VALUES('Alignment Table'[SDayLM])
VAR _RelativeSales = CALCULATE([Sales],FILTER(ALL('Alignment Table'),'Alignment Table'[Date] in _RelativeDates))
RETURN IF(NOT(ISBLANK([Sales])),_RelativeSales)
Results:
Note that on the viz I've used dadte from AligmentTable, but you should consider disable automatic date hierarchy on your dates field and build a proper calendar table for your model.
Additionaly I didn't used anything from the Invoice DateTable, because I don't know the business meaning of that table or I can't see why do you need it.
Let me know if it's a solution for your case and take care!
Hi Bolfri. Thanks so much for your help, I really appreciate it. Unfortunately I couldn't get your solution to work in my sample or master file, even after setting it up per your notes on the date tables.
I was using Invoice DateTable as my Calendar table, which is why it was included.
Thanks for the tip on the proper date table - I'll consider that 🙂