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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
yve214
Helper III
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:

DateCategoryqty
3/27/2022a2,000
3/27/2022    b2,050
3/27/2022    c3,100
3/26/2022    b2,600
3/26/2022    c3,000
3/25/2022    a1,000
3/25/2022    b1,500
3/25/2022    c2,300

 

Current results without the category column:

Dateqty
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:

DateqtyComments
3/27/2022    7,150 
3/26/2022    6,6005,600 +1,000 from 3/25 which is a friday
3/25/2022    4,800 

 

Please thank you very much.

1 ACCEPTED SOLUTION
tamerj1
Super User
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
    )

View solution in original post

2 REPLIES 2
tamerj1
Super User
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
    )

@tamerj1 

 

Yes this solved my problem, thank you so much.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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