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
Jelto
Regular Visitor

Calculate other table with active filter

Hi,

After using Google for two hours without the expection result I Really need your help. I have the following case:

Table A (artikelpost)

Entry numberPosting dateTot. werk. omzet
281024-4-2020my calculation
281124-4-2020my calculation
281224-4-2020my calculation

Table B (waardepost)

Entry numberEntryNo.TableAPosting dateTot. werk. omzet
1281024-4-2020300,25
2281020-4-2021100
3281124-4-2020200

 

In my table A I want to sum column Tot. Werk. Omzet from table B. I can do this easily with the following dax formula:

Tot. Werk. Omzet = CALCULATE(SUMX(WS_Waardeposten;WS_Waardeposten[Tot. Werk. Omzet]);FILTER(WS_Waardeposten;WS_Artikelposten[Volgnummer] = WS_Waardeposten[Artikelpostnr.]))

 

Except when I filter my table B on posting date with a slicer (example: 1-1-2020 untill 25-4-2020) I only want to sum entry number 1 in table B and not entry number 1+2.

 

How can I do this and if possible could you explain what I am doing wrong?

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

Hi @Jelto 

Create a measure

Measure =
CALCULATE (
    SUM ( TableB[Tot. werk. omzet] ),
    FILTER (
        TableB,
        TableB[EntryNo.TableA]
            = MAX ( TableA[Entry number] )
            && TableB[Posting date]
                <= MAX ( 'date'[Date] )
            && TableB[Posting date]
                >= MIN ( 'date'[Date] )
    )
)

Capture3.JPGCapture4.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Jelto 

Create a measure

Measure =
CALCULATE (
    SUM ( TableB[Tot. werk. omzet] ),
    FILTER (
        TableB,
        TableB[EntryNo.TableA]
            = MAX ( TableA[Entry number] )
            && TableB[Posting date]
                <= MAX ( 'date'[Date] )
            && TableB[Posting date]
                >= MIN ( 'date'[Date] )
    )
)

Capture3.JPGCapture4.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.