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 i have the following sample table, and i want to achieve the following.Each product can have multiple event nos.
a) Calculate date difference between 1st and last events for same product
b) Mark all event nos more than 2 days and less than 30 days for same product as Re-Event, excluding 1st Event.
Product | Event No | Date |
Product 1 | 3663328-501 | 7/27/2019 |
Product 1 | 4377204-502 | 7/28/2019 |
Product 1 | 8524894-501 | 7/29/2019 |
Product 1 | 9478521-501 | 7/30/2019 |
Product 2 | 9478521-502 | 6/15/2019 |
Product 2 | 9478521-503 | 2/15/2019 |
Product 2 | 9478521-507 | 8/15/2019 |
Product 3 | 9478521-508 | 6/15/2019 |
Product 3 | 9478521-509 | 5/27/2019 |
Product 3 | 9478521-510 | 7/20/2019 |
Product 3 | 9478521-511 | 7/27/2018 |
Product 3 | 9478521-512 | 3/27/2019 |
Product 3 | 9478521-514 | 3/28/2019 |
Product 3 | 9841725-501 | 2/15/2019 |
Product 2 | 9841725-502 | 6/16/2019 |
Product 2 | 9841725-503 | 4/15/2019 |
Product 4 | 9841725-505 | 3/27/2019 |
Product 4 | 9841725-506 | 2/17/2019 |
Product 4 | 9841725-507 | 3/24/2019 |
Product 4 | 0227975-501 | 3/27/2019 |
Product 4 | 0227975-502 | 6/15/2019 |
Product 4 | 0227975-504 | 3/27/2019 |
Product 5 | 0227975-506 | 7/27/2019 |
Product 5 | 0227975-507 | 1/27/2019 |
Product 5 | 0495169-501 | 7/27/2019 |
Product 5 | 0495169-504 | 7/29/2019 |
Product 5 | 0495169-505 | 7/30/2019 |
Product 5 | 0495169-506 | 7/31/2019 |
Product 5 | 1160976-501 | 6/15/2019 |
Product 5 | 1160976-502 | 2/15/2019 |
Product 5 | 1160976-503 | 2/17/2019 |
Product 5 | 1160976-504 | 7/29/2019 |
Product 5 | 1160976-505 | 7/30/2019 |
Product 5 | 1160976-506 | 3/27/2019 |
Product 5 | 1160976-507 | 3/27/2019 |
Hi @Mahadevaraobc ,
Here you go. Will post code in a minute.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
Interesting issue, hope this helps.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Here is my pbix https://1drv.ms/u/s!AgCd7AyfqZtExjCwBgNzr63TFQaz?e=dg6Nzh
First date = CALCULATE(MIN(Event[Date]),Event[Date],FIRSTDATE(Event[Date])) Elapsed Time = Var StartDate = CALCULATE(MIN(Event[Date]),Filter(ALLSELECTED(Event),min(Event[Date]))) Return DATEDIFF(StartDate,Event[First date],DAY) Is Re-event = IF([Elapsed Time]>3&& [Elapsed Time]<30,"Re-Event","") Event Span = DATEDIFF(FIRSTDATE(Event[Date]),LASTDATE(Event[Date]),DAY)
Proud to be a Super User!
Thanks Nathaniel_C,
This works but, there are few changes to be done, like.
Product should not be single select, when i unselect all, first date should be taken based on product 1st date and last date should be max of that product date and not all product dates.
Hi @Mahadevaraobc ,
Here is the event span, have to do something else, will be back.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Event Span = DATEDIFF(FIRSTDATE(Event[Date]),LASTDATE(Event[Date]),DAY)
Proud to be a Super User!
Hi Nathaniel_C,
Thanks for replying, this answers part of my question, could you help me with the other question...
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 |
---|---|
97 | |
94 | |
74 | |
71 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |