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
anadavalos
Frequent Visitor

adding column for distinct orders

column = calculate(SUM('Calendar for 5 day'[WorkDay]),filter('Calendar for 5 day',and('Calendar for 5 day'[Date]>orders[Order Date], 'Calendar for 5 day'[Date]<=Orders[shipped date])))

 

I am having an issue with adding a column calculating day difference for work days. My table contains orders with multiple lines for the various contents of my orders. For example, my order 123 can contain 1-10 lines and therefore order 123 appears 10 times. I have a column for the line number. The calculated column above works for the 1st line but not the rest of the lines.

Please help. Do i need to use SUMX instead or DISTINCT infront of order date and shipped date?

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

@anadavalos ,

 

Have you solved your issue by now? If you have, could you please help mark the correct answer to finish the thread? Your contribution will be much appreciated.

 

Regards,

Jimmy Tao

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@anadavalos ,

 

Have you solved your issue by now? If you have, could you please help mark the correct answer to finish the thread? Your contribution will be much appreciated.

 

Regards,

Jimmy Tao

v-yuta-msft
Community Support
Community Support

@anadavalos ,

 

Suppose the two tables have relationship with each other, you may try measure below:

column =
CALCULATE (
    SUM ( 'Calendar for 5 day'[WorkDay] ),
    FILTER (
        'Calendar for 5 day',
        AND (
            'Calendar for 5 day'[Date] > RELATED ( orders[Order Date] ),
            'Calendar for 5 day'[Date] <= RELATED ( Orders[shipped date] )
        )
    )
)

Community Support Team _ Jimmy Tao

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

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.