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
jwesle
Frequent Visitor

Help Request - Track Line Status Changes by Date

Hello,

 

I'm new to PowerBI and struggling to create code to track productivity. Below is an example of the data I am working with:

 

NameProductKeyReport DateNote
JimSilver111/14/20180
JimSilver111/15/20180
JimSilver111/16/20181
JimSilver111/17/20181
JimSilver211/15/20180
JimSilver211/16/20181
JimGold111/14/20181
JimGold111/15/20181
JimGold111/16/20181
JimGold211/15/20181
JaneBronze111/15/20181
JaneBronze111/16/20181
JaneBronze211/14/20180
JaneBronze211/15/20181
JaneBronze211/16/20181
JaneTin111/15/20180
JaneTin111/16/20181
JaneTin211/16/20180

 

Here's the situation: We are trying to calculate the number of times an individual changes the status of a line each day. When an individual completes a task, the "Note" column will change from 0 to 1. The line may be on the report for several days before and/or after the task is completed, which makes it difficult to count when the work is actually completed. For the above example, the ideal output would be the table below:

 

 11/14/201811/15/201811/16/201811/17/2018
Jim1120
Jane0210

 

Any thoughts?  Thanks!

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @jwesle,

 

You can try to use following calculated column formula to replace note column, then drag this one to matrix visual value field with summary mode 'sum'.

Replaced = 
IF (
    COUNTROWS (
        FILTER (
            Table,
            [Name] = EARLIER ( [Name] )
                && [ProductKey] = EARLIER ( Table[ProductKey] )
                && [Report Date] < EARLIER ( Table[Report Date] )
                && [Note] = 1
        )
    )
        > 0,
    0,
    [Note]
)+0

21.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @jwesle,

 

You can try to use following calculated column formula to replace note column, then drag this one to matrix visual value field with summary mode 'sum'.

Replaced = 
IF (
    COUNTROWS (
        FILTER (
            Table,
            [Name] = EARLIER ( [Name] )
                && [ProductKey] = EARLIER ( Table[ProductKey] )
                && [Report Date] < EARLIER ( Table[Report Date] )
                && [Note] = 1
        )
    )
        > 0,
    0,
    [Note]
)+0

21.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

I would add a column and use EARLIER to return a zero or 1 for whether an item was completed on a particular row. See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.