Forum Discussion
DAX - compare date field with another date field
- 8 years ago
I found the solution:
Hi fab,
You could create a calculated table with the formula below.
Table =
SUMMARIZE (
'Table1',
Table1[Current date],
'Table1'[Compare date],
"amount current date ", LOOKUPVALUE ( 'Table2'[Amount], 'Table2'[Current Date], 'Table1'[Current date] ),
"amont compare date", LOOKUPVALUE ( 'Table2'[Amount], Table2[Current Date], 'Table1'[Compare date] )
)
Here is you desired output.
More details you could have a reference of the attachment.
Hope this can help you!
Best Regards,
Cherry
- fab8 years ago
Helper I
Hello,
Thank you for your answer,
It works for the example I gave.
Actually, it's a small part of my report. My model contains many tables organized in star schema.
I am not sur this method is appropriate in my case (lookup value with many column, filters from others tables...)
Is it still working if I add others tables to my example, let's say, table 3 for product table and table 4 for customer (and so several possible values for the same date)?
regards
fab
- v-piga-msft8 years ago
Resident Rockstar
Hi fab,
It should work, you could have a try.
If you need further help, please share more details about your scenario, so that we can help further investigate on it?
If my reply help you, only thing that you'll have to notice, just always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
Best Regards,
Cherry
- fab8 years ago
Helper I
Thank you for helping me,
Here are my questions (I changed tables names and add the product table):
The new "table" is no longer works:
then, I don't know how to link this table with the others tables to apply filters (for exemple, a product "color" filter)
(I don't know how to add an attachment to this post)
regards,
Fab