Forum Discussion
jc_pbi
4 years agoNew Member
Help in DAX formula - weekly data comparison
Hi All, Good day! I just need some help on my DAX formula I'm comparing weekly data. I'm comparing week 1 data of this year to the week 1 data of last year. I have already my formula and the ...
amitchandak
Super User
4 years agojc_pbi , return this and try
Sumx(addcolumns(summarize(Dates, Dates[Year], Dates[Week]), "_1", CALCULATE([TOTAL PRINT COST],Dates[Year]=lastyear && Dates[Week of Year]=currentweekofyear)),[_1])
jc_pbi
4 years agoNew Member
Hi amitchandak
Still with no sub total.
Here is the whole formula.
PRINTCOSTLASTYEAR =
var currentyear = SELECTEDVALUE(Dates[Year])
var lastyear = currentyear-1
var currentweekofyear = SELECTEDVALUE(Dates[Week of Year])
var computedPrintCostLastYr = CALCULATE([TOTAL PRINT COST],Dates[Year]=lastyear && Dates[Week of Year]=currentweekofyear)
return
Sumx(addcolumns(summarize(Dates, Dates[Year], Dates[Week of Year]), "_1", CALCULATE([TOTAL PRINT COST],Dates[Year]=lastyear && Dates[Week of Year]=currentweekofyear)),[_1])
or screen shot of the formula
- amitchandak4 years ago
Super User
jc_pbi ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.- jc_pbi4 years agoNew Member
Hi amitchandak
Can you download the powerbi file here.
https://1drv.ms/u/s!Ak_Zk0w2DJj5czWWdW8v7RwKGx4?e=3soHg5
All data are just sample. Just go the report page 3. You may ignore the others report pages.
Thank you very much.