Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi All,
Wishing you happy new year. Starting this new year, we observed one of our
dashboard is not working. This dashboard is suppored to compare between Current month Sales vs Previous Months Sales. As of Jan 2018, Current month is going to be Jan 2018 and Previous month is going to be Dec 2017.
we are using following formula to calculate previous month sales
PrevMonthSale = CALCULATE(SUM(CustomerInvoice[PayableAmount]), PREVIOUSMONTH(CustomerInvoice[InvoiceDate])).
Any help to resolve this is very well appriciated as we are using this dashboard activily
Regards,
Prabhu Srivastava
Solved! Go to Solution.
@prabhuss,
Create the measure using one of the DAX below, then use Year field and Month field of Datetable to create slicers.
PrevMonthSale = CALCULATE(SUM(CutsomerInvoice[PayableAmount]), PREVIOUSMONTH(DateTable[Date]))
PrevMonthSale1 = CALCULATE ( SUM ( CutsomerInvoice[PayableAmount] ), DATEADD ( DateTable[Date], -1, MONTH ) )
Regards,
Lydia
Try this one
PrevMonthSale = CALCULATE ( SUM ( CustomerInvoice[PayableAmount] ), DATEADD ( CustomerInvoice[InvoiceDate], -1, MONTH ) )
I had tried earlier, and did not work for me. Even , PrevMonth = CALCULATE(SUM(CustomerInvoice[PayableAmount]), PARALLELPERIOD(CustomerInvoice[InvoiceDate],-1,MONTH)) did not work.
Your formula will also work fine. Just add a Calendar Table using CalendarAuto() function. Then create a relationship between CalendarTable and Invoice Date.
PrevMonthSale = CALCULATE(SUM(CustomerInvoice[PayableAmount]), PREVIOUSMONTH(CustomerInvoice[InvoiceDate]))
CalendarAuto() does not work for directquery. The trick i played that I created SQL Table called DateTable and
Then created a relationship between DateTable and Invoice Date.
@prabhuss,
Create the measure using one of the DAX below, then use Year field and Month field of Datetable to create slicers.
PrevMonthSale = CALCULATE(SUM(CutsomerInvoice[PayableAmount]), PREVIOUSMONTH(DateTable[Date]))
PrevMonthSale1 = CALCULATE ( SUM ( CutsomerInvoice[PayableAmount] ), DATEADD ( DateTable[Date], -1, MONTH ) )
Regards,
Lydia
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |