Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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?
Solved! Go to Solution.
Hi @joshua1990 ,
You could try to add an index.
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".
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.
Hi @joshua1990 ,
You could try to add an index.
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".
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.
@FreemanZ : Thanks. I mean the value 70 for the 3th row, it should be added into the first bucket. 50+70
User | Count |
---|---|
21 | |
19 | |
12 | |
9 | |
7 |
User | Count |
---|---|
30 | |
27 | |
14 | |
13 | |
10 |