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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

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
v-yiruan-msft
Community Support
Community Support

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

Community Support Team _ Rena
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
v-yiruan-msft
Community Support
Community Support

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

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.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.