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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

4Qrolling average

Hello,

 

I'm trying to calculate a 4Q rolling average based on my selling price, in the table 'Sell', the selling date are from the 09/01/2018 until today. 

 

Julien_FR_1-1712132028898.png

 

I looking for the average of selling price on a quarterly basis and by supplier, but I want to exclude the selling statuts "Rejected", and the type "Out".

 

I have used this formula, 4QRoll = CALCULATE(sum('Sell'[Price]),ALLEXCEPT('Sell','Sell'[Supplier]),DATESBETWEEN('Sell'[Selling Date],'Sell'[Selling Date]-365, 'Sell'[Selling Date])), but this is giving to me a yearly roll and it's not excluding the statuts "rejected" and "out". 

 

I'm in a dead end, could you support please ? 

 

Best regards, 

 

Julien

1 ACCEPTED SOLUTION

@Anonymous 

I created a file based on your data and added a calendar table as well. Please create this measure.

4Q Rolling Avg = 

CALCULATE(
    AVERAGEX(
        ADDCOLUMNS(
            DATESINPERIOD(
                'Dates'[Date],
                MAX('Dates'[Date]),
                -4,
                QUARTER
            ),
            "Price", CALCULATE(AVERAGE('Sell'[Price]))
        ),
        [Price]
    ),
    Sell[Selling Status] <> "Rejected",
    Sell[Type] <> "Out"
)

 

Fowmy_0-1712182237604.png

 

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
Anonymous
Not applicable

Hello, 

 

I want to create a line shart, with the 4Q Rolling average on Y-Axis (one line for each supplier) and the time in Year and quarter on the X-Axis. 

 

Bellow a data sample, I'm limited in number of Character

SupplierSelling DateSelling StatusTypePrice
Erita09/01/2018ClosedLocal3,2
Camila09/01/2018In progressLocal1,38
Erita09/01/2018ClosedExternal6,8
Camila09/01/2018In progressLocal4,62
Camila09/01/2018In progressLocal4,18
FIL11/01/2018ClosedOut30
Chiwe15/01/2018ClosedLocal4,32
Chiwe15/01/2018In progressLocal7,2
FIL16/01/2018ClosedLocal1,61
FIL16/01/2018RejectedExternal18,25
DLO product16/01/2018ClosedLocal2,9
Visions18/01/2018ClosedLocal0,64
Gotor22/01/2018In progressLocal5
Voleat22/01/2018ClosedLocal5,2
MG-TC24/01/2018ClosedOut4,8
Camila24/01/2018In progressLocal5,06
Camila25/01/2018In progressLocal5,06
Camila25/01/2018ClosedLocal5,06
DEC25/01/2018In progressExternal10
Erita25/01/2018In progressLocal5
Erita28/01/2018RejectedOut10
Wito29/01/2018In progressExternal2,4
Wito29/01/2018RejectedLocal0,75
Camila29/01/2018In progressOut3,08
Gotor29/01/2018ClosedLocal10
Camila29/01/2018ClosedOut6,16
Camila29/01/2018In progressLocal5,06
Camila29/01/2018ClosedLocal5,06
Voleat01/02/2018ClosedLocal4,5
Suisoa02/02/2018ClosedLocal2,7
FIL05/02/2018ClosedLocal36
Erita11/02/2018In progressLocal5
Erita13/02/2018ClosedLocal4,8
Chiwe14/02/2018In progressLocal2
Wito14/02/2018In progressLocal4,8
Wito14/02/2018RejectedLocal3
TRO15/02/2018ClosedLocal20
Chiwe19/02/2018In progressLocal1,92
DLO product21/02/2018ClosedLocal3,6
Suisoa21/02/2018ClosedLocal10,12
Voleat21/02/2018RejectedLocal5
Voleat21/02/2018ClosedLocal5,7
Erita22/02/2018In progressLocal5
Erita02/03/2018ClosedLocal2,2
Erita02/03/2018ClosedLocal2,6
Erita02/03/2018RejectedLocal10
Gotor08/03/2018In progressLocal2,4
TRO08/03/2018In progressLocal5
Voleat08/03/2018ClosedLocal7,9
SEwind09/03/2018RejectedLocal8,5
Suisoa12/03/2018ClosedLocal2,99
Suzlon12/03/2018In progressLocal7,56
Voleat12/03/2018ClosedLocal6,08
Voleat12/03/2018ClosedLocal1,08
Suisoa13/03/2018ClosedLocal2,38
Chiwe13/03/2018ClosedLocal1,2
Suisoa14/03/2018ClosedLocal22,6
Suzlon19/03/2018In progressLocal49,98
DLO product20/03/2018ClosedLocal1,82
Visions22/03/2018ClosedLocal0,96
Visions23/03/2018In progressLocal0,72
Voleat26/03/2018ClosedLocal3,08
Voleat26/03/2018ClosedLocal1,98
Chiwe26/03/2018ClosedLocal2,16
DLO product28/03/2018ClosedLocal0,63
DLO product28/03/2018ClosedLocal2
DLO product28/03/2018ClosedLocal0,96
Voleat28/03/2018ClosedLocal13,5
DLO product28/03/2018ClosedLocal0,36
DLO product28/03/2018ClosedLocal1,28
Chiwe29/03/2018ClosedLocal2,16
Voleat29/03/2018ClosedLocal4,5
Voleat29/03/2018ClosedLocal2,07
XEMC30/03/2018In progressLocal4,8
Gotor30/03/2018In progressLocal4,8
Gotor30/03/2018In progressLocal5
Erita30/03/2018In progressLocal1
Voleat30/03/2018ClosedLocal15,9
Suisoa31/03/2018In progressLocal7,3
Suisoa31/03/2018ClosedLocal0,34
Suisoa31/03/2018ClosedLocal0,2
Suisoa31/03/2018ClosedLocal0,34
Suisoa31/03/2018ClosedLocal0,68
Suisoa31/03/2018ClosedLocal1,03
Suisoa31/03/2018ClosedLocal0,2
Suisoa31/03/2018ClosedLocal0,41
Suzlon31/03/2018In progressLocal5,1
Suzlon31/03/2018In progressLocal28,5
DLO product31/03/2018ClosedLocal10
DLO product31/03/2018ClosedLocal7,48
DLO product31/03/2018ClosedLocal19,4
DLO product31/03/2018ClosedLocal1,15
DLO product31/03/2018In progressLocal30
DLO product31/03/2018ClosedLocal3,1
DLO product31/03/2018RejectedLocal6,5625
DLO product31/03/2018ClosedLocal7,6
DLO product31/03/2018ClosedLocal9,28
DLO product31/03/2018ClosedLocal1,6
DLO product31/03/2018ClosedLocal0,8
DLO product31/03/2018ClosedLocal1
DLO product31/03/2018ClosedLocal15,5
DLO product31/03/2018ClosedLocal6,3
Chiwe31/03/2018ClosedLocal12,48
Chiwe31/03/2018In progressLocal5,4
Chiwe31/03/2018ClosedLocal11,34
Chiwe31/03/2018In progressLocal29
Chiwe31/03/2018In progressLocal13,27
FIL31/03/2018In progressLocal149,04
DLO product31/03/2018In progressLocal5,8
Suisoa31/03/2018In progressLocal4,5
Suisoa31/03/2018In progressLocal7,06
DLO product31/03/2018In progressLocal8,2
DLO product31/03/2018In progressLocal10,72
DLO product31/03/2018In progressLocal52,1875
DLO product31/03/2018In progressLocal36,17
Voleat31/03/2018ClosedLocal5,05
Voleat31/03/2018ClosedLocal20,9
Voleat31/03/2018ClosedLocal13,8
Voleat31/03/2018ClosedLocal9,2
Voleat31/03/2018In progressLocal6,55
Voleat31/03/2018In progressLocal35,71
Voleat31/03/2018In progressLocal3
Erita02/04/2018In progressLocal4,6
Erita02/04/2018RejectedLocal2
Camila02/04/2018In progressLocal3,3
Gotor02/04/2018ClosedLocal10
Camila02/04/2018ClosedLocal4,62
HEAG03/04/2018In progressLocal10
TRO06/04/2018ClosedLocal10
Erita08/04/2018ClosedLocal5,06
FIL09/04/2018ClosedLocal10
Wito13/04/2018In progressLocal6
Erita13/04/2018ClosedLocal10
DLO product16/04/2018In progressLocal16,6
Gotor17/04/2018In progressLocal5
Erita17/04/2018In progressLocal10
Camila23/04/2018ClosedLocal5
Chiwe24/04/2018ClosedLocal12,6
Chiwe24/04/2018ClosedLocal2,1
Camila26/04/2018In progressLocal4,18
FIL26/04/2018ClosedLocal9,86
FIL26/04/2018ClosedLocal20,14
Chiwe03/05/2018ClosedLocal6
Voleat05/05/2018RejectedLocal4,8
Erita07/05/2018In progressLocal4,6
Camila07/05/2018In progressLocal11
Erita07/05/2018ClosedLocal10
Erita07/05/2018ClosedLocal20
Camila07/05/2018ClosedLocal25,08
Camila08/05/2018In progressLocal5,06
FIL08/05/2018ClosedLocal47
DLO product08/05/2018ClosedLocal19,95
Erita08/05/2018ClosedLocal5
FIL09/05/2018ClosedLocal1,09
FIL09/05/2018ClosedLocal1,09
Erita10/05/2018ClosedLocal10
Erita10/05/2018In progressLocal5
Erita10/05/2018In progressLocal10
Erita10/05/2018RejectedLocal3,6
Voleat10/05/2018ClosedLocal17,7

@Anonymous 

I created a file based on your data and added a calendar table as well. Please create this measure.

4Q Rolling Avg = 

CALCULATE(
    AVERAGEX(
        ADDCOLUMNS(
            DATESINPERIOD(
                'Dates'[Date],
                MAX('Dates'[Date]),
                -4,
                QUARTER
            ),
            "Price", CALCULATE(AVERAGE('Sell'[Price]))
        ),
        [Price]
    ),
    Sell[Selling Status] <> "Rejected",
    Sell[Type] <> "Out"
)

 

Fowmy_0-1712182237604.png

 

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

Fowmy
Super User
Super User

@Anonymous 

I've got a question, how are you going to visualize this result? Could you share an expected out put layout ( What is in rows, column and values? May be result based on your sample data. You may copy and paste in your reply rather than pasting as image which I cannot use to test the working.

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

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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