Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Counting value changes in given time period

Hi everyone, 

 

I am pretty new to PowerBI, and need some help. Here is some information regarding the problem that I am unsure how to approach.

 

Data Source: SharePoint Online List

What do I want to achieve: To count (+/-) that the value has changed in the last 7 days. (i.e. In the left column I currently have 51 requests, and last week I had 42 requests - in the right-hand column I want to show that I have had +9 requests)

 

I was able to do the initial total requests by just using the created date and filtering by in the last 7 days but I am unsure how to approach the following ones.

 

Each request moves through 7 phases, and what I want to communicate is how the value has changed within each phase over the course of the last week. I do not have a date field in my SharePoint list for recording each change in the status.

 

I would also like to communicate this with positive and negative signs (+/-) before the number.

 

Please see a mockup here:

Thanks in advance!

 

 

 

 

 

  • Hi Anonymous

     

    In the absence of your sample data, maybe you can measure like:

    Measure = 
    var this_week=
    CALCULATE(
        SUM([values]),
        FILTER(
            'Table',
            'Table'[Date]=thisweek  //  return date of this week
    ))
    var Last_week=
    CALCULATE(
        SUM([values]),
        FILTER(
            'Table',
            'Table'[Date]=thisweeek-7 // return date of last week
    ))
    return
    IF(
        this_week-Last_week>0,
        CONCATENATE("+",this_week-Last_week),
        this_week-Last_week
    )

     

    Best Regards,

    Link

4 Replies