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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

5 Consecutive Day-Over-Day Sales Increase

Dear all,

 

I have built a PBI report showing the day-over-day increase (the red triangles) of our stores' sales. Is there any way to highlight those stores with day-over-day increases for 5 consecutive days?

 

FredYeung_856_0-1657009531678.png


Please kindly advise, thanks

 

Fred

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

And because I am using my sample, I tried to create a measure for finding Four-days-consecutive-increase-store.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create your own measure for your data model.

 

sample.png

 

Sales measure: = 
SUM( Sales[Sales] )

 

DoD increase: = 
VAR _yesterdaysales =
    CALCULATE ( [Sales measure:], 'Calendar'[Date] = MAX ( 'Calendar'[Date] ) - 1 )
VAR _todaysales = [Sales measure:]
RETURN
    IF ( _todaysales > _yesterdaysales, 0, 1 )

 

Four days increase consecutive: = 
VAR _newtable =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALL ( Sales ), Sales[Store] = MAX ( Store[Store] ) ),
            'Calendar'[Date]
        ),
        "@DoD_condition", [DoD increase:]
    )
VAR _addcumulatevalue =
    ADDCOLUMNS (
        _newtable,
        "@cumulate_condition",
            SUMX (
                FILTER ( _newtable, 'Calendar'[Date] <= EARLIER ( 'Calendar'[Date] ) ),
                [@DoD_condition]
            )
    )
VAR _groupbycumulatecondition =
    FILTER (
        GROUPBY (
            _addcumulatevalue,
            [@cumulate_condition],
            "@fourormoreconsecutive", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@fourormoreconsecutive] > 4
    )
VAR _condition =
    COUNTROWS ( _groupbycumulatecondition ) <> BLANK ()
RETURN
    _condition

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

Hi,

Thank you for your feedback.

I am not sure how you want to display, but please check the below picture and the attached file.

 

Untitled.png

 

Sales measure only true: = 
IF ( [Four days increase consecutive:] = TRUE (), [Sales measure:], BLANK () )

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

And because I am using my sample, I tried to create a measure for finding Four-days-consecutive-increase-store.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create your own measure for your data model.

 

sample.png

 

Sales measure: = 
SUM( Sales[Sales] )

 

DoD increase: = 
VAR _yesterdaysales =
    CALCULATE ( [Sales measure:], 'Calendar'[Date] = MAX ( 'Calendar'[Date] ) - 1 )
VAR _todaysales = [Sales measure:]
RETURN
    IF ( _todaysales > _yesterdaysales, 0, 1 )

 

Four days increase consecutive: = 
VAR _newtable =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALL ( Sales ), Sales[Store] = MAX ( Store[Store] ) ),
            'Calendar'[Date]
        ),
        "@DoD_condition", [DoD increase:]
    )
VAR _addcumulatevalue =
    ADDCOLUMNS (
        _newtable,
        "@cumulate_condition",
            SUMX (
                FILTER ( _newtable, 'Calendar'[Date] <= EARLIER ( 'Calendar'[Date] ) ),
                [@DoD_condition]
            )
    )
VAR _groupbycumulatecondition =
    FILTER (
        GROUPBY (
            _addcumulatevalue,
            [@cumulate_condition],
            "@fourormoreconsecutive", SUMX ( CURRENTGROUP (), 1 )
        ),
        [@fourormoreconsecutive] > 4
    )
VAR _condition =
    COUNTROWS ( _groupbycumulatecondition ) <> BLANK ()
RETURN
    _condition

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Anonymous
Not applicable

Thanks Jihwan

 

May I consult with you on how to just display the stores if the four consecutive days condition is "TRUE"?

 

 

Hi,

Thank you for your feedback.

I am not sure how you want to display, but please check the below picture and the attached file.

 

Untitled.png

 

Sales measure only true: = 
IF ( [Four days increase consecutive:] = TRUE (), [Sales measure:], BLANK () )

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

amitchandak
Super User
Super User

@Anonymous , Assume you already have DOD measure with help from date table try a measure like

 

Rolling 5 = If( calculate(Sumx(Values('Date'[Date]),if([DOD] >0,1,0)),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,day)) = 5, 1, blank())

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Thanks  @amitchandak 

 

However, I encounter the following error. Is there anything i did wrong?

 

FredYeung_856_0-1657011782090.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.