The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
18 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
36 | |
35 | |
19 | |
18 | |
18 |