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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Junaid11
Helper V
Helper V

Divide Latest week value with sum of Sales

Hello,

I want to divide the latest AR value with sum of Salesand then multiply it with number of Days. But when I am dividing it with total sales value it is automatically dividing it with all week sales. I am attaching my data as well as outcome I want to have. Kindly have a look at it. A help would be highly appreciated.

Thank you

 

Weeknum Sales  AR Days in week
1 $    594,935.76 $      343,466,7677
2 $    423,051.96 $        67,955,89414
3 $    378,467.79 $              568,56921
4 $    379,376.90 $           8,990,95528
5 $    459,192.74 $        17,413,34135
6 $ 1,065,006.10 $        25,835,72742
7 $    642,491.90 $           5,201,53349

sddfvvvv.PNG

Outcome I need is for week 7 it would be ($ 5,201,533/$ 3,942,523.15) * 49 = 64.533

64.533 would be the outcome for week 7.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Junaid11 ,

You can create a measure as below to get it, please find the details in the attachment.

Measure = 
VAR _selweek =
    SELECTEDVALUE ( 'Table'[Weeknum] )
VAR _sales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Weeknum] <= _selweek )
    )
VAR _ar =
    CALCULATE (
        SUM ( 'Table'[AR] ),
        FILTER ( 'Table', 'Table'[Weeknum] = _selweek )
    )
VAR _days =
    CALCULATE (
        MAX ( 'Table'[Days in week] ),
        FILTER ( 'Table', 'Table'[Weeknum] = _selweek )
    )
RETURN
    DIVIDE ( _ar, _sales ) * _days

yingyinr_0-1648802516966.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Junaid11 ,

You can create a measure as below to get it, please find the details in the attachment.

Measure = 
VAR _selweek =
    SELECTEDVALUE ( 'Table'[Weeknum] )
VAR _sales =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Weeknum] <= _selweek )
    )
VAR _ar =
    CALCULATE (
        SUM ( 'Table'[AR] ),
        FILTER ( 'Table', 'Table'[Weeknum] = _selweek )
    )
VAR _days =
    CALCULATE (
        MAX ( 'Table'[Days in week] ),
        FILTER ( 'Table', 'Table'[Weeknum] = _selweek )
    )
RETURN
    DIVIDE ( _ar, _sales ) * _days

yingyinr_0-1648802516966.png

Best Regards

PijushRoy
Super User
Super User

Hi @Junaid11 

Please try this

Measure = DIVIDE(SUM('Table'[ AR ]),CALCULATE(SUM('Table'[ Sales ]),ALL('Table '[Weeknum])))*SELECTEDVALUE('Table'[Days in week])


If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos



Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.