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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Kolumam
Post Prodigy
Post Prodigy

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:

 

Capture.JPG

 

Import Table:

 

Import Table consists of Month, Station ID and Expected Energy

MonthStation IdExpected 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.

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create two simple tables to test:

DirectQuery table

11.PNG

 

Import table

12.PNG                                                           

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:

13.PNG

 

Best Regards,

Giotto Zhi

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create two simple tables to test:

DirectQuery table

11.PNG

 

Import table

12.PNG                                                           

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:

13.PNG

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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