cancel
Showing results for
Did you mean:
Helper III

## Duplicating values for two dates

Hi there,

Please I need some urgent help. I am trying to calculate my quantity values where I duplicate a value for friday to reflect on saturday as well. Here is a sample data

Data:

 Date Category qty 3/27/2022 a 2,000 3/27/2022 b 2,050 3/27/2022 c 3,100 3/26/2022 b 2,600 3/26/2022 c 3,000 3/25/2022 a 1,000 3/25/2022 b 1,500 3/25/2022 c 2,300

Current results without the category column:

 Date qty 3/27/2022 7,150 3/26/2022 5,600 3/25/2022 4,800

Expected results if we duplicate every Friday value for category a only to add on Saturdays as well:

 Date qty Comments 3/27/2022 7,150 3/26/2022 6,600 5,600 +1,000 from 3/25 which is a friday 3/25/2022 4,800

1 ACCEPTED SOLUTION
Super User

Hi @yve214

not sure if I fully understand the requirement. However, please try

``````Total Qty =
VAR CurrentValue =
SUM ( TableName[qty] )
VAR PreviousValue =
CALCULATE (
SUM ( TableName[qty] ),
'Date'[Date]
= MAX ( 'Date'[Date] ) - 1,
TableName[Category] = "a"
)
RETURN
IF (
MAX ( 'Date'[Week Day Name] ) = "Saturday",
CurrentValue + PreviousValue,
CurrentValue
)``````
2 REPLIES 2
Super User

Hi @yve214

not sure if I fully understand the requirement. However, please try

``````Total Qty =
VAR CurrentValue =
SUM ( TableName[qty] )
VAR PreviousValue =
CALCULATE (
SUM ( TableName[qty] ),
'Date'[Date]
= MAX ( 'Date'[Date] ) - 1,
TableName[Category] = "a"
)
RETURN
IF (
MAX ( 'Date'[Week Day Name] ) = "Saturday",
CurrentValue + PreviousValue,
CurrentValue
)``````
Helper III

Yes this solved my problem, thank you so much.

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors