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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PSB
Helper III
Helper III

Calculate Formula for 7 days rolling and then median of that result by day

Step 1: Calculate Formula based on last 7 days data for different "Market"

Each of the value is created with sum of previous 7 days values. Sample in table below.

Forumula column in Date 11/7 should caluculate below value based on data from 11/1 to 11/7

Formula: =(SUM(C2:C8)+SUM(D2:D8)-SUM(E2:E8))/(SUM(F2:F8)+SUM(G2:G8))

 

DateMarketABCDEFFormula
11/1/2024New Jersey12345335466442 
11/2/2024New Jersey34575224434522 
11/3/2024New Jersey44223223644166 
11/4/2024New Jersey22454433432345 
11/5/2024New Jersey667356234541 
11/6/2024New Jersey34554634223575432 
11/7/2024New Jersey4124454666233450.17
11/8/2024New Jersey43264432345455750.06
11/9/2024New Jersey3453334541723-0.19
11/10/2024New Jersey57525754325445-0.25
11/1/2024Boston23223233452447 
11/2/2024Boston4566455756454 
11/3/2024Boston7345723345244 
11/4/2024Boston5441544557564 
11/5/2024Boston244432244662333 
11/6/2024Boston64345223345452 
11/7/2024Boston33575444175460.68
11/8/2024Boston223356432234320.50
11/9/2024Boston2234563444453450.42
11/10/2024Boston44754635675750.02
11/1/2024NYC356236746345423 
11/2/2024NYC6344563454622345 
11/3/2024NYC5467546432447 
11/4/2024NYC6745467434535654 
11/5/2024NYC345244345575634244 
11/6/2024NYC566456432546223 
11/7/2024NYC56533565345432440.03
11/8/2024NYC562545753453560.08
11/9/2024NYC56223244235756340.08
11/10/2024NYC878446445323340.23

 

Step 2: once we have above result.

I need median by date for each day

 

Date 
11/1/2024 
11/2/2024 
11/3/2024 
11/4/2024 
11/5/2024 
11/6/2024 
11/7/20240.17
11/8/20240.08
11/9/20240.08
11/10/20240.02

 

 

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

11 REPLIES 11
Ahmedx
Super User
Super User

and try median

Screenshot_2.png

 

Ahmedx
Super User
Super User

pls try

Screenshot_1.png

STEP 1 is perfactly working but not step 2.

For each market, I have this "NSA_DCR_Median" value, now I need median for this values on daily level. "=MEDIAN(C2:C28)" 

 

final result for below data should be (this example is only for one day.

 

PERIOD_START_TIMENSA_DCR_Median
11/30/2023 0:000.62

 

Data

PERIOD_START_TIMEMARKETNSA_DCR_Median
11/30/2023 0:00Albuquerque1.08
11/30/2023 0:00Atlanta0.58
11/30/2023 0:00Central PA0.37
11/30/2023 0:00Connecticut0.62
11/30/2023 0:00Hawaii0.66
11/30/2023 0:00Jacksonville0.45
11/30/2023 0:00LA North0.91
11/30/2023 0:00Las Vegas1.42
11/30/2023 0:00Long Island0.60
11/30/2023 0:00Los Angeles0.97
11/30/2023 0:00Miami0.64
11/30/2023 0:00New England0.60
11/30/2023 0:00New Jersey0.50
11/30/2023 0:00New York0.61
11/30/2023 0:00North Carolina0.75
11/30/2023 0:00Orlando0.46
11/30/2023 0:00Philadelphia0.57
11/30/2023 0:00Sacramento0.65
11/30/2023 0:00Salt Lake City0.86
11/30/2023 0:00San Diego0.69
11/30/2023 0:00San Francisco0.64
11/30/2023 0:00South Carolina0.57
11/30/2023 0:00Southern California1.01
11/30/2023 0:00Tampa0.61
11/30/2023 0:00Upstate NY0.88
11/30/2023 0:00Virginia0.62
11/30/2023 0:00Washington DC0.58

try this

Screenshot_2.png

 

when I tried by calculating it from previous measure, it's not giving correct result.

 

PSB_0-1701546779627.png

 

I'm no longer interested in solving all your problems in this scenario.

thanks for your time and effort. 

Ahmedx
Super User
Super User

WHAT IS THIS AND WHERE IS COLUMN
G2:G8

=(SUM(C2:C8)+SUM(D2:D8)-SUM(E2:E8))/(SUM(F2:F8)+SUM(E2:E8))

 

DateMarketABCDEFFormula
11/1/2024New Jersey12345335466442 
11/2/2024New Jersey34575224434522 
11/3/2024New Jersey44223223644166 
11/4/2024New Jersey22454433432345 
11/5/2024New Jersey667356234541 
11/6/2024New Jersey34554634223575432 
11/7/2024New Jersey4124454666233450.17
11/8/2024New Jersey43264432345455750.05
11/9/2024New Jersey3453334541723-0.12
11/10/2024New Jersey57525754325445-0.16
11/1/2024Boston23223233452447 
11/2/2024Boston4566455756454 
11/3/2024Boston7345723345244 
11/4/2024Boston5441544557564 
11/5/2024Boston244432244662333 
11/6/2024Boston64345223345452 
11/7/2024Boston33575444175460.89
11/8/2024Boston223356432234320.52
11/9/2024Boston2234563444453450.34
11/10/2024Boston44754635675750.01
11/1/2024NYC356236746345423 
11/2/2024NYC6344563454622345 
11/3/2024NYC5467546432447 
11/4/2024NYC6745467434535654 
11/5/2024NYC345244345575634244 
11/6/2024NYC566456432546223 
11/7/2024NYC56533565345432440.02
11/8/2024NYC562545753453560.07
11/9/2024NYC56223244235756340.08
11/10/2024NYC878446445323340.27

I have this type of data for 100 different Market. I need 7 days rolling by this formula for each market and then calculate Median based on values for each of market on daily basis.

PSB
Helper III
Helper III

@Ahmedx could you please help?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.