Forum Discussion
Dax Help for two different tables
Hello,
I need help with the following. I have the following tables:
1. VAS Table with the following values for columns Date and Subject
2. Sales Table with values for Date and Subject as well.
I want to group the VAS and Sales table by date and then subtract the count. For example:
VAS:
Date Subject
1/21/2019 aaa
1/21/2019 bbb
1/22/2019 ccc
1/22/2019 ddd
1/22/2019 eee
1/22/2019 fff
Sales
Date Subject
1/21/2019 aaa
1/22/2019 bbb
1/22/2019 ccc
I have created a date table with unique dates. I want to add a column in it from the previous two tables with the following:
Date Count
1/21/2019 1 (subtracted from VAS - Sales for that date)
1/22/2019 2 (subtracted from VAS - Sales for that date)
Any help is appreciated!
Thank you!
Neetu
Hi Anonymous
Try this for the column, where NewTable is the last table you show:
Count = CALCULATE ( COUNT ( VAS[Date] ), FILTER ( VAS, VAS[Date] = NewTable[Date] ) ) - CALCULATE ( COUNT ( Sales[Date] ), FILTER ( Sales, Sales[Date] = NewTable[Date] ))
1 Reply
- AlBCommunity Champion
Hi Anonymous
Try this for the column, where NewTable is the last table you show:
Count = CALCULATE ( COUNT ( VAS[Date] ), FILTER ( VAS, VAS[Date] = NewTable[Date] ) ) - CALCULATE ( COUNT ( Sales[Date] ), FILTER ( Sales, Sales[Date] = NewTable[Date] ))