Forum Discussion
Issue with relating direct query and import tables
Hi All,
I have two tables one is direct query and other is import model.
Direct Query Table:
Import Table:
Import Table consists of Month, Station ID and Expected Energy
| Month | Station Id | Expected Energy |
Basically, I need to create relationships in such a way that
IF (Table 1[Eac-MFM] > 0 , Table 2 [Expected Energy], 0)
I tried creating a relationship between the month in both tables and it created many to many relationships but I am not able to execute the above if condition because of direct query limitations.
Hi,
According to your description, i create two simple tables to test:
DirectQuery table
Import table
Then create a measure:
Measure = IF ( COUNTROWS ( 'Sales-2' ) > 0, IF ( SUM ( 'Sales-1'[Sales] ) > 0, CALCULATE ( SUM ( 'Sales-2'[Expected Sales] ), 'Sales-2'[Category] IN FILTERS ( 'Sales-1'[Category] ) ), 0 ) )Add this measure to DirectQuery table(Sales-1) as a table visual and it shows:
Best Regards,
Giotto Zhi
1 Reply
- v-gizhi-msft
Community Support
Hi,
According to your description, i create two simple tables to test:
DirectQuery table
Import table
Then create a measure:
Measure = IF ( COUNTROWS ( 'Sales-2' ) > 0, IF ( SUM ( 'Sales-1'[Sales] ) > 0, CALCULATE ( SUM ( 'Sales-2'[Expected Sales] ), 'Sales-2'[Category] IN FILTERS ( 'Sales-1'[Category] ) ), 0 ) )Add this measure to DirectQuery table(Sales-1) as a table visual and it shows:
Best Regards,
Giotto Zhi