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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Jyaul1122
Helper III
Helper III

Many to Many Measures

Hello,

I have two tables Status and Address in relation with many to many via Project (status) and Project(address) column.

Jyaul1122_0-1759210157726.pngJyaul1122_1-1759210200824.png

I would like to get status of Project from Status table based on month selection from slicer and display on  Address table(all column) in a report.

So that I wrote measure: Status_ = MAX('Status'[Status]) but its not working properly.

Jyaul1122_2-1759210541150.png

What I need, If month Jan 25 is selected then result:

Jyaul1122_3-1759210721085.png

if Feb 25 selected:

Jyaul1122_4-1759210796845.png

if March 25 selected:

Jyaul1122_5-1759210860959.png

means , I need to bring status from Status table by Project by month. How can I achieve using measures ?

Sample data:

Status Table  
Project(Status)MonthStatus
P125-JanHigh
P225-JanHigh
P125-FebLow
P225-FebHigh
P325-MarMedium
P425-MarVery Low

 

Adress Table  
Project(Address)Sub ProjectAddress
P1P1.1Japan
P1P1.2USA
P1P1.3England
P2P2.1Germany
P3P3.1Italy
P2P2.2Norway
1 ACCEPTED SOLUTION

Hi @Jyaul1122 ,

Thanks for reaching out to Microsoft Fabric Community.

I tested the scenario using the same sample data shared above.

Since TREATAS was causing performance issues in your model, here's an alternative approach using FILTER and IN, which avoids TREATAS and performs better in heavier models.

Here's the measure:

Status by Month = 
VAR SelMonth = SELECTEDVALUE('Status'[Month])
RETURN
CALCULATE (
    MAX('Status'[Status]),
    FILTER (
        ALL('Status'),
        'Status'[Month] = SelMonth &&
        'Status'[Project] IN VALUES('Address'[Project])
    )
)

 

vveshwaramsft_0-1759742278452.png

Please find attached .pbix for reference and reach out for any further assistance.
Thank you.

 

Thanks @rohit1991 , @mdaatifraza5556 and @BernardBonto for your valuable inputs.

 

View solution in original post

8 REPLIES 8
BernardBonto
New Member

Hi Jyaul1122,

 

Maybe this can help. I have created a date table from min and max date value and use it as a filter.

 

Table:
        Date = GENERATESERIES(MIN('Status'[Month]), MAX('Status'[Month]))
Filter: 
        MonthYear = FORMAT('Date'[Date], "MMM-YYYY")
Measure: 
       Max Status = COALESCE(MAX('Status'[Status]),"")
 

 

BernardBonto_0-1759386383536.png

 

Jan-2025

BernardBonto_2-1759386448932.png

 

Feb-2025

BernardBonto_3-1759386474444.png

Mar-2025

BernardBonto_4-1759386484441.png

 

Bernard

 

 

mdaatifraza5556
Super User
Super User

Hi @Jyaul1122 

Could you please try the below dax to create the dax ?

Selected Status =
VAR SelectedMonth = SELECTEDVALUE('Status'[Month])
VAR ThisProject = SELECTEDVALUE('Address'[Project(Address)])

RETURN
CALCULATE(
    MAX('Status'[Status]),
    FILTER(
        'Status',
        'Status'[Project(Status)] = ThisProject &&
        'Status'[Month] = SelectedMonth
    )
)
Screenshot 2025-09-30 120719.png

 

Screenshot 2025-09-30 120724.png

 

Screenshot 2025-09-30 120728.png

 

Also attached the pbix file for you reference.

If this answers your questions, kindly accept it as a solution and give kudos.

@mdaatifraza5556 

 

Thanks for your idea but slicer is not going to work.

Jyaul1122_0-1759215883809.png

 

rohit1991
Super User
Super User

Hi @Jyaul1122 

Could you please try below Steps:


1. Below is the sample data that I used to solve this problem
image.png

 

 

 

 

 

 

 

 

 

image.png

 

 

 

 

 

 

 

2. Modeling:
image.png

 

3. Created Measure :

Status by Month = 
VAR SelMonth =
    SELECTEDVALUE ( 'Status'[Month] )
RETURN
MAXX (
    FILTER (
        'Status',
        'Status'[Project] = MAX ( 'Address'[Project] ) &&
        'Status'[Month] = SelMonth
    ),
    'Status'[Status]
)

4. Outcome:


image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

@rohit1991 

Thanks for your reply, but Project P3 is missing. I would like to have all Project from Address table where the status is blank or not.

Jyaul1122_0-1759213966175.png

 

Hi @Jyaul1122 

Could you please try below Steps:


1. Below is the sample data that I used to solve this problem

rohit1991_0-1759214715782.png

image.png

 

 

 

 

 

 

 

 

2. Create new Table

ProjectDim = 
DISTINCT (
    UNION (
        SELECTCOLUMNS ( 'Address', "Project", 'Address'[Project] ),
        SELECTCOLUMNS ( 'Status', "Project", 'Status'[Project] )
    )
)

3. Change Modeling

  • ProjectDim[Project] >> Address[Project] (One-to-Many)

  • ProjectDim[Project] >> Status[Project] (One-to-Many)

image.png4. Create Meaure: 

Status by Month = 
VAR SelMonth = SELECTEDVALUE ( 'Status'[Month] )
RETURN
CALCULATE (
    MAX ( 'Status'[Status] ),
    TREATAS ( { SelMonth }, 'Status'[Month] ),
    TREATAS ( VALUES ( 'Address'[Project] ), 'Status'[Project] )
)

5. Right-click the Project field and enable the option Show items with no data.

 

 

image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

@rohit1991 

Treatas function is taking long time to respond as my model is to heavy , Could you please try with another funtion ?

Hi @Jyaul1122 ,

Thanks for reaching out to Microsoft Fabric Community.

I tested the scenario using the same sample data shared above.

Since TREATAS was causing performance issues in your model, here's an alternative approach using FILTER and IN, which avoids TREATAS and performs better in heavier models.

Here's the measure:

Status by Month = 
VAR SelMonth = SELECTEDVALUE('Status'[Month])
RETURN
CALCULATE (
    MAX('Status'[Status]),
    FILTER (
        ALL('Status'),
        'Status'[Month] = SelMonth &&
        'Status'[Project] IN VALUES('Address'[Project])
    )
)

 

vveshwaramsft_0-1759742278452.png

Please find attached .pbix for reference and reach out for any further assistance.
Thank you.

 

Thanks @rohit1991 , @mdaatifraza5556 and @BernardBonto for your valuable inputs.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.