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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
joshua1990
Post Prodigy
Post Prodigy

Add blank weeks into first week of extract

Hi experts!

I have a weekly archive of our sales data:

Archival Year-Week Actual Year-Week Value
2023-01 2023-01 50
2023-01 2023-02 60
2023-01 NA 70
2023-02 2023-02 80
2023-03 2023-03 50

 

As you can see, the actual year-week column is sometimes "NA". If this is the case I would like to put it into the first year-Week for each extract.

For instance, in table above the rows 3 should be added into the 2023-01 bucket with the value 70. > 50+70

 

How would you do that in dax?

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @joshua1990 ,

 

You could try to add an index.

vstephenmsft_0-1683870472635.pngvstephenmsft_1-1683870481106.png

Create a measure.

Measure = var _sum1=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Actual Year-Week]="NA"))
var _sum2=SUM('Table'[Value])
return IF(MAX('Table'[Index])=1,_sum1+_sum2,_sum2)

Create the below visual, filter out "NA". 

44.png 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @joshua1990 ,

 

You could try to add an index.

vstephenmsft_0-1683870472635.pngvstephenmsft_1-1683870481106.png

Create a measure.

Measure = var _sum1=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Actual Year-Week]="NA"))
var _sum2=SUM('Table'[Value])
return IF(MAX('Table'[Index])=1,_sum1+_sum2,_sum2)

Create the below visual, filter out "NA". 

44.png 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

joshua1990
Post Prodigy
Post Prodigy

No ideas?
FreemanZ
Super User
Super User

hi @joshua1990 

what do you mean by "with the value 70. > 50+70"?

@FreemanZ : Thanks. I mean the value 70 for the 3th row, it should be added into the first bucket. 50+70

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

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.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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