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

Complicated Table Links

The example file is here

I am trying to calculate the sum of Usage_Table[Qty]

                                                     WHERE

                                                        Usage_Table[Month] = Calendar[MonthData]

                                                       AND

                                                      Usage_Table[Part] = Receiving_Table[Part]

                                                                                       WHERE

                                                                                            Receiving_Table[Month] = Calendar[MonthData]

 

The Month to MonthData is a Many-To-Many Relationship.

Part is also a Many-To-Many Relationship.

 

The problem is that PowerBi doesn't like circulated reference nor many to many relationships.

 

 

 

Thank you!

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

The many to many relationship is unsupported in Power BI. For your scenario, you canget a integrated table by inner join function , then usethe integrated table to create the report. Please follow the steps below.

1. Create AA table using the formula.

AA =
FILTER (
    CROSSJOIN (
        FILTER (
            CROSSJOIN ( Receiving_Table, Usage_Table ),
            Receiving_Table[Part1] = Usage_Table[Part]
        ),
        'Calendar'
    ),
    'Calendar'[MonthData_C] = Receiving_Table[Month1]
)


2. Create Table 'BB' based on 'AA'.

BB =
SELECTCOLUMNS (
    AA,
    "Date", AA[Month1],
    "Usage_Month", AA[Month],
    "Calendar_month", AA[Month_C],
    "Part_M", AA[Part],
    "Qty_Usage", AA[Qty],
    "Qty_Receiving", AA[Qty1]
)


3. Create the integrated table use the formula.

CC = FILTER(CROSSJOIN('Calendar',BB),'Calendar'[MonthData_C]=BB[Date])


4. Create measure using the formula.

Result = SUM(CC[Qty_Usage])


Please download the file for more details.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

The many to many relationship is unsupported in Power BI. For your scenario, you canget a integrated table by inner join function , then usethe integrated table to create the report. Please follow the steps below.

1. Create AA table using the formula.

AA =
FILTER (
    CROSSJOIN (
        FILTER (
            CROSSJOIN ( Receiving_Table, Usage_Table ),
            Receiving_Table[Part1] = Usage_Table[Part]
        ),
        'Calendar'
    ),
    'Calendar'[MonthData_C] = Receiving_Table[Month1]
)


2. Create Table 'BB' based on 'AA'.

BB =
SELECTCOLUMNS (
    AA,
    "Date", AA[Month1],
    "Usage_Month", AA[Month],
    "Calendar_month", AA[Month_C],
    "Part_M", AA[Part],
    "Qty_Usage", AA[Qty],
    "Qty_Receiving", AA[Qty1]
)


3. Create the integrated table use the formula.

CC = FILTER(CROSSJOIN('Calendar',BB),'Calendar'[MonthData_C]=BB[Date])


4. Create measure using the formula.

Result = SUM(CC[Qty_Usage])


Please download the file for more details.

Best Regards,
Angelia

Anonymous
Not applicable

I am trying to calculate the sum of Usage_Table[Qty]

                                                     WHERE

                                                        Usage_Table[Month] = Calendar[MonthData]

                                                       AND

                                                      Usage_Table[Part] = Receiving_Table[Part]

                                                                                       WHERE

                                                                                            Receiving_Table[Month] = Calendar[MonthData]

 

The Month to MonthData is a Many-To-Many Relationship.

Part is also a Many-To-Many Relationship.

 

The problem is that PowerBi doesn't like circulated reference nor many to many relationships.

 

I attached the example file in next reply.

 

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.