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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Totals not working on Matrix

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. prioryear.png

 

currentyear.png

 

report.png

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 .dax_.png

 

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

hi, @Anonymous 

This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

If you still have the problem, please share a simple sample pbix file and expected output.

 

Best Regards,

Lin

 

Community Support Team _ Lin
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-lili6-msft
Community Support
Community Support

hi, @Anonymous 

This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

If you still have the problem, please share a simple sample pbix file and expected output.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Here's the Dax code, sorry but for some reason it is not letting me add the code to original post;

 

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] ) )
    )

Let me know if any need additional information is needed.

Anonymous
Not applicable

 

Blank.pngI have Measure to Calc Prior Year Sales, if the current year selected week sales are blank I don't want to display the PY Sales for the store. On the day level Dax calc is working fine if you see on the attached screenshot Tuesday doesn't have data but on Store level the sum 82795 also includes the tuesday Prior Year Sales. How to exclude that ? Here my Dax Measure I'm working on;

dax_.png

 

 

Anonymous
Not applicable

Measure is not showing right Totals , 

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] ) )
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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