Forum Discussion

vazmor's avatar
vazmor
Icon for Helper II rankHelper II
6 years ago

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

 

3 Replies