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
vazmor
Helper II
Helper II

Calculate Same store or not same store

Hi there,

Everyone, I have researched in various forums and community posts and tried the dax adapting it to my modeling, so far I have not obtained what I need, for this reason I leave the file with my modeling, as well as the image with the results that I want to obtain when making the filter (It is what appears as a title in the tables of the image). The Formula I leave is an example of what I have adapted.

To know that the result is correct in the image we have Brand 3 with 586,435.33, but in the PBIX file attached with the attached formula it gives me 585,721.54 this is because there is a client that in December 2018 is listed as a transfer but in December 2019 It's like New Door, which I need you to ignore last year's transfer.

I hope you can help me.

 

 

Attached file

File Test 

 

Dax currently

 

 

Sales Value LY LFL = 
VAR CustomersInvoices = 
    ADDCOLUMNS (
        VALUES ( Fac_Sales[ID_LFL] ), -- Use Customers table if you have one
         "AmountCurrentMonth", [Sales Value],
        "AmountPreviousMonth", CALCULATE ( [Sales Value],CROSSFILTER('Calendar'[Date],'dDate'[Date],OneWay),SAMEPERIODLASTYEAR(dDate[Date]) )
    )
VAR CustomersWithGrowth =
    FILTER ( CustomersInvoices, [ID_LFL] =[ID_LFL] )
VAR Result =
  SUMX ( CustomersWithGrowth,[AmountPreviousMonth])
RETURN Result

 

 

Expected results

 

Result.PNG

3 REPLIES 3
amitchandak
Super User
Super User

I will try to make YTD dependent LYTD like

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31")) 
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31")
filter(Sales, not(isblank([Last YTD Sales])))) 
Greg_Deckler
Super User
Super User

Sample data as text. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks, out of editing my post. @Greg_Deckler .

@amitchandak  Solution did not work.

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.