Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I'm trying to get my sales for the same month last year but specific to the slicer. When I use this formula:
Last Year Same Month = CALCULATE ( SUM ('Sell In'[Sales]), FILTER ( ALLSELECTED ( 'Sell In'), YEAR ( 'Sell In'[Month].[Date] ) = YEAR ( MAX ( 'Sell Out'[Date].[Date] ) ) - 1 && MONTH ( 'Sell In'[Month].[Date]) = MONTH ( MAX ( 'Sell Out'[Date] ) ) ) )
HI @Anonymous ,
I'd like some sample data to help us clarify your scenario.
How to Get Your Question Answered Quickly
BTW, you can also try to remove suffix and use original date fields as condition for calculate:
Last Year Same Month = CALCULATE ( SUM ( 'Sell In'[Sales] ), FILTER ( ALLSELECTED ( 'Sell In' ), YEAR ( 'Sell In'[Month] ) = YEAR ( MAX ( 'Sell Out'[Date] ) ) - 1 && MONTH ( 'Sell In'[Month] ) = MONTH ( MAX ( 'Sell Out'[Date] ) ) ) )
Regards,
Xiaoxin Sheng
Is there no way to create a column that calculates the previous year's same month column? So I can create a column where it shows the previous year's month but then want something like this:
And the do a sumifs formula to get the sales for each product:
HI @Anonymous ,
You can try to use following calculated column formula if it works for your requirement:
Last Year Same Month = CALCULATE ( SUM ( 'Table'[Sales] ), FILTER ( ALL ( 'Table' ), YEAR ( 'Table'[Month] ) = YEAR ( EARLIER ( 'Table'[Month] ) ) - 1 && MONTH ( 'Table'[Month] ) = MONTH ( EARLIER ( 'Table'[Date] ) ) && Table[Product] = EARLIER ( Table[Product] ) ) )
If above not help, please share a pbix file with some sample data for test.
Regards,
Xiaoxin Sheng
Hi,
When I applied the formula, it gave me a figure much higher than anticipated. I realised I also needed to include retailer. I tried to do that:
Last Year Same Month = CALCULATE ( SUM ( 'Table'[Sales] ), FILTER ( ALL ( 'Table' ), YEAR ( 'Table'[Month] ) = YEAR ( EARLIER ( 'Table'[Month] ) ) - 1 && MONTH ( 'Table'[Month] ) = MONTH ( EARLIER ( 'Table'[Date] ) ) && Table[Product] = EARLIER ( Table[Product] ) && Table[Retailer] = EARLIER ( Table[Retailer] ) ) )
it gives me the following error:
"Cannot nest EARLIER/EARLIEST functions."
Thanks
HI @Anonymous ,
If you can please share us a sample pbix file for test, it will help for test to modify dax formula.
Regards,
Xiaoxin Sheng
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |