Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
Measure is not working at totals level. Created a new Measure which calculates the Prior year Sales Amount WTD, On the Power BI report there are 3 scliers to select Year, Week and Status. Here is the Dax Measure
On the Matix report I need show Channel ,Distrinct ,Store Number ,Status,SalesAmt , SalesAmtPy and status can change over time So when calcualting PY I need to ignore the Status from Prior Year and show only the current year Status with SalesAmt and SalesAmtPy on one line.To acheive this I used the above Calc which seems to be working fine but the totals and subtotals in matrix report or totals in tabular report are not correct. Only at the lowest level in matrix they are calculating fine. on the higher level it is not .
Solved! Go to Solution.
Here is the Dax code
SalesAmtPY:= VAR DateRange = FILTER ( ALL ( 'DimDate' ), 'DimDate'[AdjustedYearNumber] = VALUES ( 'DimDate'[AdjustedYearNumber] ) - 1 && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearNumber] ), 'DimDate'[AdjustedWeekofYearNumber], 'DimDate'[AdjustedWeekofYearNumber] ) && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ), 'DimDate'[AdjustedWeekofYearandDayofWeekNumber], 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ) ) RETURN IF ( ISBLANK ( [SalesAmt] ), BLANK (), CALCULATE ( 'FactSales'[SalesAmt], DateRange, ALL ( DimStatus[StatusDescription],DimStatus[Status] ) ) )
Here is the Dax code
SalesAmtPY:= VAR DateRange = FILTER ( ALL ( 'DimDate' ), 'DimDate'[AdjustedYearNumber] = VALUES ( 'DimDate'[AdjustedYearNumber] ) - 1 && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearNumber] ), 'DimDate'[AdjustedWeekofYearNumber], 'DimDate'[AdjustedWeekofYearNumber] ) && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ), 'DimDate'[AdjustedWeekofYearandDayofWeekNumber], 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ) ) RETURN IF ( ISBLANK ( [SalesAmt] ), BLANK (), CALCULATE ( 'FactSales'[SalesAmt], DateRange, ALL ( DimStatus[StatusDescription],DimStatus[Status] ) ) )
Here is the Dax Code;
SalesAmtPY:= VAR DateRange = FILTER ( ALL ( 'DimDate' ), 'DimDate'[AdjustedYearNumber] = VALUES ( 'DimDate'[AdjustedYearNumber] ) - 1 && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearNumber] ), 'DimDate'[AdjustedWeekofYearNumber], 'DimDate'[AdjustedWeekofYearNumber] ) && CONTAINS ( VALUES ( 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ), 'DimDate'[AdjustedWeekofYearandDayofWeekNumber], 'DimDate'[AdjustedWeekofYearandDayofWeekNumber] ) ) RETURN IF ( ISBLANK ( [SalesAmt] ), BLANK (), CALCULATE ( 'FactSales'[SalesAmt], DateRange, ALL ( DimStatus[StatusDescription],DimStatus[Status] ) ) )
@Anonymous wrote:Hi,
Measure is not working at totals level. Created a new Measure which calculates the Prior year Sales Amount WTD, On the Power BI report there are 3 scliers to select Year, Week and Status. Here is the Dax Measure
On the Matix report I need show Channel ,Distrinct ,Store Number ,Status,SalesAmt , SalesAmtPy and status can change over time So when calcualting PY I need to ignore the Status from Prior Year and show only the current year Status with SalesAmt and SalesAmtPy on one line.To acheive this I used the above Calc which seems to be working fine but the totals and subtotals in matrix report or totals in tabular report are not correct. Only at the lowest level in matrix they are calculating fine. on the higher level it is not .
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
77 | |
73 | |
58 | |
35 | |
31 |
User | Count |
---|---|
99 | |
57 | |
56 | |
46 | |
40 |