Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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...
User | Count |
---|---|
80 | |
74 | |
62 | |
61 | |
45 |
User | Count |
---|---|
108 | |
97 | |
88 | |
81 | |
61 |