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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Trolleri
Helper I
Helper I

Tag orderlines with the same salestime in each order

Hello,

 

I have a order table where each product in an order has their own orderrow.

Im trying to tag all orderrows in an order that has the same salestime, so for example, if i have an order with 4 items and 3 of them was sold at the same time, i want those marked. I only want this behaviour if it is 2 or more rows in an order with the saletime.

 

so the table consists of the following rows:

order_id,orderrow_id,product_id,quantity,price,salestime

 

Any ideas?

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Trolleri ,

 

According to your description, you can create a calculated column to count the number of rows under an order that meet the sales time on the same day greater than 2. Then apply a custom background-color to order_id. refer to the following test results.

 

row_ =
CALCULATE (
    COUNTROWS ( 'Table' ),
    ALL ( 'Table' ),
    'Table'[order_id] = EARLIER ( 'Table'[order_id] )
        && 'Table'[salestime] = EARLIER ( 'Table'[salestime] )
)

 

vhenrykmstf_1-1655882845998.png

 

vhenrykmstf_0-1655882804570.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Trolleri ,

 

According to your description, you can create a calculated column to count the number of rows under an order that meet the sales time on the same day greater than 2. Then apply a custom background-color to order_id. refer to the following test results.

 

row_ =
CALCULATE (
    COUNTROWS ( 'Table' ),
    ALL ( 'Table' ),
    'Table'[order_id] = EARLIER ( 'Table'[order_id] )
        && 'Table'[salestime] = EARLIER ( 'Table'[salestime] )
)

 

vhenrykmstf_1-1655882845998.png

 

vhenrykmstf_0-1655882804570.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

PC2790
Community Champion
Community Champion

You can consider using RANKX function.

How to use RANKX in DAX (Part 1 of 3 - Calculated Columns) - RADACAD

If you can provide your sample data and the required result set, I can provide you with the solution.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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