Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

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] ))

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

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] ))

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.