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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

SUM Range divided by Sum Range last 6 rows

Hi Guys,

 

What I would like to get is, each new month to show :

Range of last 6 month (Sale)  / Range of last 6 month (Shop 1 - Categories). 

Anyone could help please ?

sonicmaster_0-1649160940628.png

 

 

MonthSaleShop 1 - Categories
Jan12004
Feb13002
Mar8005
Apr5004
May6004
Jun1505
Jul12005 
   
1 ACCEPTED SOLUTION

Hi, @Anonymous 

Please try measure formulas as below:

Measure1 =
SUMX (
    TOPN (
        6,
        FILTER ( ALL ( 'Table' ), 'Table'[ID] <= MAX ( 'Table'[ID] ) ),
        'Table'[ID], DESC
    ),
    'Table'[Sale]
)
Measure2 =
SUMX (
    TOPN (
        6,
        FILTER ( ALL ( 'Table' ), 'Table'[ID] <= MAX ( 'Table'[ID] ) ),
        'Table'[ID], DESC
    ),
    'Table'[Shop 1 - Categories]
)
Result = [Measure1]/[Measure2]

1.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

OK I managed to get a bit forward with that :

I added ID column 1 2 3 4 ect.

 

My meaurement =
DIVIDE(SUMx(TOPN(6,'Table','Table'[ID],DESC),'Table'[Sale]),SUMx(TOPN(6,'Table','Table'[ID],DESC),'Table'[Shop 1 - Categories]),0)
 
So card can show values I want  in connection with column chart ( each time I select another month it all adds up) ,but how to set my results  416,300,253,231,189 on Line chart ? 
 
Please help ?
 
 
sonicmaster_0-1649322447868.png

 

Hi, @Anonymous 

Please try measure formulas as below:

Measure1 =
SUMX (
    TOPN (
        6,
        FILTER ( ALL ( 'Table' ), 'Table'[ID] <= MAX ( 'Table'[ID] ) ),
        'Table'[ID], DESC
    ),
    'Table'[Sale]
)
Measure2 =
SUMX (
    TOPN (
        6,
        FILTER ( ALL ( 'Table' ), 'Table'[ID] <= MAX ( 'Table'[ID] ) ),
        'Table'[ID], DESC
    ),
    'Table'[Shop 1 - Categories]
)
Result = [Measure1]/[Measure2]

1.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.