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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

TREATAS filter propagation

Hello

Given the following data model:

kamilzet___1-1636987975537.png

 


I would like to create a measure that would aggregate an attribute from the table [ServiceCases]. The design should allow me also to slice [ServiceCases] table using [SalesInvoiceDate] time table.

This is the initial code I created:

Some fee = 
CALCULATE(
    [# ServiceCases], -- COUNTROWS(ServiceCases)
        USERELATIONSHIP(SalesInvoiceDate[SalesInvoiceDate],SalesOrder[InvoiceDate]), -- to activate the relationship
        TREATAS(values(ServiceCases[RelatedDocumentNo]),SalesOrder[InternDocumentNumber]) -- to map one table into another)
    )


Unfortunately, when I put attributes and the measure I'm interested in, I get record multuplication:

kamilzet___2-1636988400224.png

Can anyone explain to me this strange behaviour?



2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

@Anonymous  I tested out with the following model and it is giving me what was desired

| SalesInvoice     |
|------------------|
| SalesInvoiceDate |
|------------------|
| 2021-01-01       |
| 2021-01-02       |
| 2021-01-03       |


|            SalesOrder           |
|-------------|------|------------|
| InvoiceDate | Doc# | Date       |
|-------------|------|------------|
| 2021-01-01  | 123  | 2021-01-01 |
| 2021-01-02  | 231  | 2021-01-02 |
| 2021-01-03  | 312  | 2021-01-03 |
| 2021-01-01  | 456  | 2021-01-01 |
| 2021-01-02  | 567  | 2021-01-02 |
| 2021-01-03  | 789  | 2021-01-03 |

| ServiceCases |
|--------------|
| Docu#        |
|--------------|
| 456          |
| 456          |
| 789          |
| 456          |
| 789          |
| 1000         |
| 2000         |

 

smpa01_0-1637091478270.png

 

 

pbix is attached

smpa01_1-1637091572411.png

 

If you are experiencing a different behaviour, can you please post the pbix here?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

I tested by simple data ,and you could try it .

vyalanwumsft_0-1637210878019.png

 

Some fee =
VAR _id =
    SUMMARIZE (
        FILTER (
            ALL ( 'SalesOrder' ),
            'SalesOrder'[InvoiceDate] = MAX ( 'SalesOrder'[InvoiceDate] )
        ),
        [InternDocumentNumber]
    )
RETURN
    CALCULATE (
        COUNTROWS (
            FILTER ( ALL ( 'ServiceCases' ), 'ServiceCases'[RelatedDocumentNo] IN _id )
        ),
        USERELATIONSHIP ( 'SalesInvoice'[SalesInvoiceDate], 'SalesOrder'[InvoiceDate] )
    )

 

The final output is shown below:

vyalanwumsft_1-1637210965308.png

If not right, can you tell the result what you want output in my simple data or change the simple data to similar with yours?


Best Regards,
Community Support Team_ Yalan Wu
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

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan Wu

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

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

I tested by simple data ,and you could try it .

vyalanwumsft_0-1637210878019.png

 

Some fee =
VAR _id =
    SUMMARIZE (
        FILTER (
            ALL ( 'SalesOrder' ),
            'SalesOrder'[InvoiceDate] = MAX ( 'SalesOrder'[InvoiceDate] )
        ),
        [InternDocumentNumber]
    )
RETURN
    CALCULATE (
        COUNTROWS (
            FILTER ( ALL ( 'ServiceCases' ), 'ServiceCases'[RelatedDocumentNo] IN _id )
        ),
        USERELATIONSHIP ( 'SalesInvoice'[SalesInvoiceDate], 'SalesOrder'[InvoiceDate] )
    )

 

The final output is shown below:

vyalanwumsft_1-1637210965308.png

If not right, can you tell the result what you want output in my simple data or change the simple data to similar with yours?


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

smpa01
Super User
Super User

@Anonymous  I tested out with the following model and it is giving me what was desired

| SalesInvoice     |
|------------------|
| SalesInvoiceDate |
|------------------|
| 2021-01-01       |
| 2021-01-02       |
| 2021-01-03       |


|            SalesOrder           |
|-------------|------|------------|
| InvoiceDate | Doc# | Date       |
|-------------|------|------------|
| 2021-01-01  | 123  | 2021-01-01 |
| 2021-01-02  | 231  | 2021-01-02 |
| 2021-01-03  | 312  | 2021-01-03 |
| 2021-01-01  | 456  | 2021-01-01 |
| 2021-01-02  | 567  | 2021-01-02 |
| 2021-01-03  | 789  | 2021-01-03 |

| ServiceCases |
|--------------|
| Docu#        |
|--------------|
| 456          |
| 456          |
| 789          |
| 456          |
| 789          |
| 1000         |
| 2000         |

 

smpa01_0-1637091478270.png

 

 

pbix is attached

smpa01_1-1637091572411.png

 

If you are experiencing a different behaviour, can you please post the pbix here?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

@Anonymous  can you try this instead

 

Some fee =
CALCULATE(
[# ServiceCases], -- COUNTROWS(ServiceCases)
USERELATIONSHIP(SalesInvoiceDate[SalesInvoiceDate],SalesOrder[InvoiceDate]), -- to activate the relationship
TREATAS(values(SalesOrder[InternDocumentNumber]),ServiceCases[RelatedDocumentNo]) -- to map one table into another)
)

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

@smpa01 The value for metric [Some fee] actually changed, but it's still a total spread across all the lines, w/o the slice I'm looking for, so it doesn't solve the issue.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.