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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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