Forum Discussion

vasu6811's avatar
vasu6811
Frequent Visitor
9 years ago

not able to display graph using measure

Hi All,

 

I am facing an issue in Power BI Desktop. I have created a measure for calculating last status based on timestamp for each employee. Now I want to draw a bar chart to display count of emplyee for each status.

 

Here is sample data

 

EmployeeIdStatusIDDatestamp
112017-05-01 11:30:00
132017-05-01 11:35:00
122017-05-01 11:40:00
232017-05-01 11:30:00
222017-05-01 11:35:00
212017-05-01 11:40:00
332017-05-01 11:42:00
412017-05-01 11:42:00

 

Status Table

StatusIDStatus Name
1Started
2In progress
3Completed

 

I am expecting result in graph as following (count of employee is based on latest status 

 

Status NameCount of Employees
Started2
In progress1
Completed1

 

Thanks in Advance.

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    vasu6811

     

    Hi,

     

    At the first glance, it's very easy. But there are many tricks. A calculated column is recommended. Here is the formula. Please have a try.

    IsLatest =
    CALCULATE (
        IF ( COUNT ( 'Sample'[Datestamp] ) = 1, 1, 0 ),
        FILTER (
            'Sample',
            'Sample'[Datestamp] >= EARLIER ( 'Sample'[Datestamp] )
                && 'Sample'[EmployeeId] = EARLIER ( 'Sample'[EmployeeId] )
        )
    )

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards.

    Dale

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    vasu6811

     

    Hi,

     

    Could you please tell me if your problem is solved? You can mark the right answer to help others if it's convenient for you.

     

    Best Regards!
    Dale