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.
Hi all!
I am trying to determine the order of events based on dates. I have an identifier column that says if it’s the first event or last event. But I am clueless on how to determine anything in between. Would you have any suggestions for me?
Sample table I’m working with.
ClientID | Price | Date | FirstSale | LastSale |
1 | 50 | 01.01.2023 | 01.01.2023 | 12.05.2023 |
1 | 30 | 24.04.2023 | 01.01.2023 | 12.05.2023 |
1 | 55 | 27.04.2023 | 01.01.2023 | 12.05.2023 |
1 | 80 | 12.05.2023 | 01.01.2023 | 12.05.2023 |
2 | 15 | 27.11.2022 | 27.11.2022 | 01.04.2023 |
2 | 40 | 05.02.2023 | 27.11.2022 | 01.04.2023 |
2 | 50 | 10.03.2023 | 27.11.2022 | 01.04.2023 |
2 | 35 | 01.04.2023 | 27.11.2022 | 01.04.2023 |
I am expecting to write a measure or a new column that would identify whether a certain row contain data for 2nd, 3rd, etc sale.
Would you please be able to help me with an idea that could solve this?
Solved! Go to Solution.
You could do it either as a column or as a measure
Rank Column =
RANK(, ALL( 'Table'[ClientID], 'Table'[Date] ),
ORDERBY( 'Table'[Date], ASC),
PARTITIONBY('Table'[ClientID]) )
Rank Measure =
RANK(, ALLSELECTED( 'Table' ),
ORDERBY( 'Table'[Date], ASC),
PARTITIONBY('Table'[ClientID]) )
You could do it either as a column or as a measure
Rank Column =
RANK(, ALL( 'Table'[ClientID], 'Table'[Date] ),
ORDERBY( 'Table'[Date], ASC),
PARTITIONBY('Table'[ClientID]) )
Rank Measure =
RANK(, ALLSELECTED( 'Table' ),
ORDERBY( 'Table'[Date], ASC),
PARTITIONBY('Table'[ClientID]) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
105 | |
79 | |
68 | |
61 |
User | Count |
---|---|
143 | |
104 | |
103 | |
82 | |
70 |