Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Retrieve only one rows with two status

Hi All,

Below is my data.

DateJobNameStep NumberStep NameStatus
6/16/2021CRM dataStep1Load Staging DataSuccess
6/16/2021CRM dataStep2Load WareHouseDataSuccess
6/16/2021CRM dataStep3Load DataMartSuccess
6/16/2021CRM dataStep4Process CubeFail
6/16/2021Sales dataStep1Load Staging DataSuccess
6/16/2021Sales dataStep2Load WareHouseDataSuccess
6/16/2021Sales dataStep3Load DataMartSuccess
6/16/2021Sales dataStep4Process CubeRunning
6/16/2021Dimension LoadStep1Load Staging DataSuccess
6/16/2021Dimension LoadStep2Load WareHouseDataSuccess
6/16/2021Dimension LoadStep3Load DataMartSuccess


I want to see the Job status only. I'm taking Job Name ans Status in Matrix and it is showing mw the job status as well if job is successfully completed. but the problem is if a job is failed the it is showing me two status for one job. Success and Failed both. where in I only want to see if all step is success then it should show success and it any of step is failed then it should show as failed with one row or if it is running then it should show as running.

Below is the output which I'm getting right now.

JobNameStatus
CRM dataSuccess
CRM dataFail
Sales dataSuccess
Sales dataRunning
Dimension LoadSuccess

 

Where in the expected output is as below.

JobNameStatus
CRM dataFail
Sales dataRunning
Dimension LoadSuccess



This is because one step is completed and one step is failed and it is showing both result since it is not unique. hence reqesting you to kindly suggest a solution.

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Create the following measure and add this measure and the Job Name in a table or matrix visuals:

Final Status = 
var __t = CALCULATETABLE( Table1 , ALLEXCEPT( Table1 , Table1[JobName] )) return
SWITCH(
    TRUE(),
    CONTAINS(__t,Table1[Status],"Fail") , "Fail",
    CONTAINS(__t,Table1[Status],"Running") , "Running",
    "Sucess"
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

It is for creating a measure.

 

Picture1.png

 

Status Last step number measure =
VAR currentdate =
MAX ( 'Table'[Date] )
VAR currentjobname =
MAX ( 'Table'[JobName] )
VAR laststepnumber =
CALCULATE (
MAX ( 'Table'[Step Number] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] = currentdate
&& 'Table'[JobName] = currentjobname
)
)
RETURN
IF (
ISFILTERED ( 'Table'[JobName] ),
CALCULATE (
MAX ( 'Table'[Status] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] = currentdate
&& 'Table'[JobName] = currentjobname
&& 'Table'[Step Number] = laststepnumber
)
)
)

 

 

https://www.dropbox.com/s/o45li1conjvsrjk/shahabh.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Fowmy
Super User
Super User

@Anonymous 

Create the following measure and add this measure and the Job Name in a table or matrix visuals:

Final Status = 
var __t = CALCULATETABLE( Table1 , ALLEXCEPT( Table1 , Table1[JobName] )) return
SWITCH(
    TRUE(),
    CONTAINS(__t,Table1[Status],"Fail") , "Fail",
    CONTAINS(__t,Table1[Status],"Running") , "Running",
    "Sucess"
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi @Fowmy  Thanks a lot. You're a true champion.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors