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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
fazou
Frequent Visitor

USERRELATIONSHIP

Hello Guys 🙂 

i have a problem using USERELATIONSHIP (maybe it's not the problem) i'll explain.

Below my model

fazou_0-1747780902460.png

Below the results 

fazou_1-1747781021418.png

i'm selecting WTD from TBD_PERIOD which is 19/05/2025 until 25/05/2025, my measure total sales CY by Segment should display 302,06 like the right table(from sales table TBF_SALES) because i have only one sales in the selected period which made 19/05/2025.

But in the left table it display two rows one 12/03/2025 (from outside the period) with 603,38 and one in the 19/05/2026 with also 603,28.

in reality the row from 12/03/2025 has sales value 301,32 which not should counted at alla because he is outside WTD from 19/05/2025 until 25/05/2025,and the row from 19/05/2025 has 302,06 like show in sales table at right table.

my measure sum the two rows and give 603,38 everywhere in left table,the right behavior should display only one row with discover and sales value of 302,06, and start_date 19/05/2025, he is like he can't get the period

below my measure

Total Sales CY by Segment =
CALCULATE(
    SUM('DTM TBF_SALES'[NET_SALES]),USERELATIONSHIP('DTM TBF_SALES'[CUSTOMER_ID],'DTM TBF_SEGMENTATION_HISTO'[CUSTOMER_ID]),
    'DTM TBD_PERIOD'[CALENDAR_TYPE] = "CY",'DTM TBF_SEGMENTATION_HISTO'[START_DATE]>=MAX('DTM TBF_SEGMENTATION_HISTO'[START_DATE]))


thanks for help 🙂 

 

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

Hi @fazou ,
Thank you for reaching out to us on Microsoft Fabric Community Forum!

Upon my understanding,I tried to recreate it on my end.So I followed below steps which might help you to resolve the issue.

1.Create a calulated column using below:

SegmentAtSaleDate =
CALCULATE (
    MAX ( 'TBF_SEGMENTATION_HISTO'[SEGMENT] ),
    FILTER (
        'TBF_SEGMENTATION_HISTO',
        'TBF_SEGMENTATION_HISTO'[CUSTOMER_ID] = 'TBF_SALES'[CUSTOMER_ID] &&
        'TBF_SEGMENTATION_HISTO'[START_DATE] <= 'TBF_SALES'[ORIGINAL_ORDER_DATE]
    )
)

2.Then create a measure using below:
TTotal Sales CY by Segment =
VAR SelectedStart = MIN('TBD_PERIOD'[START_DATE])
VAR SelectedEnd = MAX('TBD_PERIOD'[END_DATE])
RETURN
CALCULATE (
    SUM('TBF_SALES'[NET_SALES]),
    FILTER (
        'TBF_SALES',
        'TBF_SALES'[ORIGINAL_ORDER_DATE] >= SelectedStart &&
        'TBF_SALES'[ORIGINAL_ORDER_DATE] <= SelectedEnd
    )
)

3.Please refer the screenshot and file for your reference:
vpagayammsft_0-1747809463727.png


Hope this answer meets your requirements.If so,give us kudos and consider accepting it as solution.

Regards,
Pallavi.

View solution in original post

5 REPLIES 5
v-pagayam-msft
Community Support
Community Support

Hi @fazou ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Thank you.

v-pagayam-msft
Community Support
Community Support

Hi @fazou ,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
If our response addressed your query, please mark it as Accept Answer and click Yes if you found it helpful.
If you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!

v-pagayam-msft
Community Support
Community Support

Hi @fazou ,
Following up to check whether you got a chance to review the suggestion given.If it helps,consider accepting it as solution,it will be helpful for other members of the community who have similar problems as yours to solve it faster. Glad to help.
Thank you.

v-pagayam-msft
Community Support
Community Support

Hi @fazou ,
Thank you for reaching out to us on Microsoft Fabric Community Forum!

Upon my understanding,I tried to recreate it on my end.So I followed below steps which might help you to resolve the issue.

1.Create a calulated column using below:

SegmentAtSaleDate =
CALCULATE (
    MAX ( 'TBF_SEGMENTATION_HISTO'[SEGMENT] ),
    FILTER (
        'TBF_SEGMENTATION_HISTO',
        'TBF_SEGMENTATION_HISTO'[CUSTOMER_ID] = 'TBF_SALES'[CUSTOMER_ID] &&
        'TBF_SEGMENTATION_HISTO'[START_DATE] <= 'TBF_SALES'[ORIGINAL_ORDER_DATE]
    )
)

2.Then create a measure using below:
TTotal Sales CY by Segment =
VAR SelectedStart = MIN('TBD_PERIOD'[START_DATE])
VAR SelectedEnd = MAX('TBD_PERIOD'[END_DATE])
RETURN
CALCULATE (
    SUM('TBF_SALES'[NET_SALES]),
    FILTER (
        'TBF_SALES',
        'TBF_SALES'[ORIGINAL_ORDER_DATE] >= SelectedStart &&
        'TBF_SALES'[ORIGINAL_ORDER_DATE] <= SelectedEnd
    )
)

3.Please refer the screenshot and file for your reference:
vpagayammsft_0-1747809463727.png


Hope this answer meets your requirements.If so,give us kudos and consider accepting it as solution.

Regards,
Pallavi.

Ashish_Excel
Resolver V
Resolver V

Hi,

Cannot understand your question.  Share some data to work with, explain the question and show the expected result.  Share data in a format that can be pasted in an MS Excel file.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.