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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mweber
Frequent Visitor

Measure Subtotal Not Working

I'm trying to create a visual where a user can quickly look at year-over-year sales comparisons

 

My current visual: column 1 = date, column 2 = sales for selected date range (in 2019) & column 3 = sales from same period last year.

 

Column 2 measure = CALCULATE(SUM('Weekly Sales'[Sales]),FILTER('Weekly Sales','Weekly Sales'[InvoiceDate]))

Column 3 measure = CALCULATE(SUM('Weekly Sales'[Sales]),SAMEPERIODLASTYEAR('Calendar (2)'[Date]))

A relationship between Calendar (2) & Invoice date has been created.

 

Column 3 is yeiding the results for a specific date as one would expect. However, the subtotal on the visual is not correct. I have been trying HASONEFILTER & HASONEVALUE with no success. Any help would be appreciated!

 

 

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

This looks like a measure totals problem. Very common. See my post about it here: 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

 

Also, look for Matrix Measure Triple Threat Rock & Roll in the Quick Measures gallery, provides even more guidance on things like this.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the reference but still not getting there... tried this formula and still getting wrong totals:

 

Measure - = if(HASONEFILTER('Calendar (2)'[Date]),CALCULATE(SUM('Weekly Sales'[Sales]),SAMEPERIODLASTYEAR('Calendar (2)'[Date])),CALCULATE(SUMX('Weekly Sales','Weekly Sales'[Sales]),FILTER('Calendar (2)',SAMEPERIODLASTYEAR('Calendar (2)'[Date]))))
 
 
 
dax
Community Support
Community Support

Hi mweber, 

If possible, could you please inform me more detailed information(such as your sample data and your expected output or your pbix  file)? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

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

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.