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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sublog
Helper III
Helper III

Same Store Sales Growth in Calculation Groups?

Hi all, working in Tabular Editor, I have created some calculation groups that measure YTD/MTD Year over Year growth %, but I would like to only calculate this for locations that had sales in the prior period/year. We've added many new locations in the past year and the growth numbers are obviously inflated because we've added 40 locations in the past 6 months. 

Here's what I am using today for my QTD calculation measure. 

 

 

Placeholder =
VAR CYQTD =
    CALCULATE (
        SELECTEDMEASURE (),
        CALCULATETABLE ( DATESQTD ( 'Calendar'[Date] ), 'Calendar'[IsPast] = TRUE () )
    )
VAR PYQTD =
    CALCULATE (
        SELECTEDMEASURE (),
        CALCULATETABLE (
            DATEADD ( DATESQTD ( 'Calendar'[Date] )-1YEAR ),
            'Calendar'[IsPast] = TRUE ()
        )
    )
VAR YOYQTD = ( CYQTD - PYQTD )
RETURN
    DIVIDE ( YOYQTDPYQTD )

3 REPLIES 3
amitchandak
Super User
Super User

@sublog , Assuming you have location[location] or table[location]

 

Change in your formula at the end

 

VAR YOYQTD = Sumx(values(Location[Location]), if(not(isblank(PYQTD)), ( CYQTD - PYQTD ), blank()))
RETURN
DIVIDE ( YOYQTD, PYQTD )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Okay, I replaced the VAR YOYQTD = ( CYQTD - PYQTD ) section with what you gave me above, but the numbers are not correct? I assume you meant location as the table that contains my locations? 

Thank you, I will check on this and report back! 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.