March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have a table called "Jira tickets", in which I have multiple rows for the same ticket, as you can see below in the sample data:
If we take for example Ticket 1, how can I compare the rows to take only the first Sprint when this ticket was in status "Done", based on the Status date? In this case, to have a calculated column that will say "include" for Sprint 7 (08-Sep-22) and "exclude" for Sprint 8 (04-Oct-22). I will have to do the same thing for the status "To Do".
Thank you very much! 😊
Solved! Go to Solution.
Hi @MikiMihaela27
Please try
Include/Exclude =
VAR CurrentStatus = 'Jira tickets'[Status]
VAR CurrentDate = 'Jira tickets'[Status Date]
VAR CurrentKeyTable =
CALCULATETABLE (
'Jira tickets',
ALLEXCEPT ( 'Jira tickets', 'Jira tickets'[Key] )
)
VAR FilteredTable =
FILTER ( CurrentKeyTable, 'Jira tickets'[Status] = "Done" )
VAR FirstDone =
MINX ( FilteredTable, 'Jira tickets'[Status Date] )
RETURN
IF (
CurrentStatus = "Done",
IF ( CurrentDate = FirstDone, "Include", "Exclude" )
)
Hi @MikiMihaela27 ,
Please create following column:
Column =
var min_date = MINX(FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])),[Status Date])
var max_date = MAXX(FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])),[Status Date])
var count_status = CALCULATE(COUNT('Table'[Status]),FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])))
return
SWITCH(
TRUE(),
'Table'[Status Date] = min_date && count_status = 2, "include",
'Table'[Status Date] = max_date && count_status = 2, "exclude"
)
I think this is the result you want:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MikiMihaela27 ,
Please create following column:
Column =
var min_date = MINX(FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])),[Status Date])
var max_date = MAXX(FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])),[Status Date])
var count_status = CALCULATE(COUNT('Table'[Status]),FILTER('Table','Table'[Key] = EARLIER('Table'[Key]) && 'Table'[Status] = EARLIER('Table'[Status])))
return
SWITCH(
TRUE(),
'Table'[Status Date] = min_date && count_status = 2, "include",
'Table'[Status Date] = max_date && count_status = 2, "exclude"
)
I think this is the result you want:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
i tried, but unable to reach the last step, check if a row exists in another intermediate table.
the code for the intermediate table physically :
Hi @MikiMihaela27
Please try
Include/Exclude =
VAR CurrentStatus = 'Jira tickets'[Status]
VAR CurrentDate = 'Jira tickets'[Status Date]
VAR CurrentKeyTable =
CALCULATETABLE (
'Jira tickets',
ALLEXCEPT ( 'Jira tickets', 'Jira tickets'[Key] )
)
VAR FilteredTable =
FILTER ( CurrentKeyTable, 'Jira tickets'[Status] = "Done" )
VAR FirstDone =
MINX ( FilteredTable, 'Jira tickets'[Status Date] )
RETURN
IF (
CurrentStatus = "Done",
IF ( CurrentDate = FirstDone, "Include", "Exclude" )
)
Hi @tamerj1
Thank you for your message! It really helped me a lot! In fact, I adjusted a bit the logic to display "include/exclude" for both 'To Do' and 'Done' statuses:
IncludevsExclude =
VAR CurrentStatus = 'Jira tickets'[Status]
VAR CurrentDate = 'Jira tickets'['Jira tickets' Status Date]
VAR CurrentKeyTable =
CALCULATETABLE (
'Jira tickets',
ALLEXCEPT ( 'Jira tickets', 'Jira tickets'[Key])
)
VAR FilteredTableDone =
FILTER ( CurrentKeyTable, 'Jira tickets'[Status] = "Done" )
VAR FilteredTableToDo =
FILTER ( CurrentKeyTable, 'Jira tickets'[Status] = "To Do" )
VAR FirstDone =
MINX ( FilteredTableDone, 'Jira tickets' [Status Date])
VAR FirstToDo =
MINX ( FilteredTableToDo, 'Jira tickets' [Status Date])
RETURN
IF (
CurrentStatus = "Done",
IF ( CurrentDate = FirstDone, "Include", "Exclude" ),
IF(
CurrentStatus = "To Do",
IF ( CurrentDate = FirstToDo, "Include", "Exclude" )
))
Thanks again! 😊
how to handle the status of In Progress?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
28 | |
21 | |
20 | |
13 | |
10 |