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
r_fioretti
Helper I
Helper I

SUMMARIZE two tables many to many Relationship

I'm trying to get this in Excel (Edit DAX in Table) and I need the column 'table2'[DesPro], but I can't figure it out how to do that.

 

So far, I have:

FILTER(
    SUMMARIZE(
        table1,
        table1[NF Saída],
        table1[Título],
        table1[Total],
        table1[Ult. Pgto],
        'table2'[DesPro] --  where table1[NF Saída]='table2'[Nota Fiscal] with many to many relationship. A union table with all distinct values from both tables had been created
    ),
        table1[Ult. Pgto] <> BLANK()&&table1[Ult. Pgto] >= DATE(2023, 1, 1)
)
 
 
I appreciate any help.
4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @r_fioretti ,

 

Please try:

Table=
FILTER(
    SUMMARIZE(
        table1,
        table1[NF Saída],
        table1[Título],
        table1[Total],
        table1[Ult. Pgto],
        "DesPro",MAX('Table2'[DesPro])
    ),
        table1[Ult. Pgto] <> BLANK()&&table1[Ult. Pgto] >= DATE(2023, 1, 1)
)

vtangjiemsft_0-1705975019881.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi,
I'm using Excel and It didn't work. It brings just the MAX value. Instead, I need to bring all values.
I don’t know why but I can’t attach an example file. Here’s a link to access it. SUMMARIZE-Ex.xlsx 
I appreciate.



Hi @r_fioretti ,

 

Model Relationship:

vtangjiemsft_0-1706082617206.png

Please try:

Table = FILTER(
    SUMMARIZE(
        table1,
        table1[NF Saída],
        table1[Título],
        table1[Total],
        table1[Ult. Pgto],
        "DesPro",LOOKUPVALUE('Table2'[DesPro],'Table2'[Nota Fiscal],'Table1'[NF Saída])
    ),
        table1[Ult. Pgto] <> BLANK()&&table1[Ult. Pgto] >= DATE(2023, 1, 1)
)

Or:

Table = FILTER(
    SUMMARIZE(
        table1,
        table1[NF Saída],
        table1[Título],
        table1[Total],
        table1[Ult. Pgto],
        "DesPro",CALCULATE(SUM('Table2'[DesPro]),FILTER(ALL('Table2'),'Table2'[Nota Fiscal]=EARLIER('Table1'[NF Saída])))
    ),
        table1[Ult. Pgto] <> BLANK()&&table1[Ult. Pgto] >= DATE(2023, 1, 1)
)

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi,
It didn’t work.

In Power BI the relationship many to many works well. Unfortunately, I need this model in Excel to meet the final user needs. I have an intermediary table with unique values as a work around to this many to many relationships, it should work but it isn’t.




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.