The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Team,
I am struggling with some query i.e
I want to compare previous months date like 1st January 2018 to 8th January 2018 from 1st January 2018 to 8th January 2018 sale difference in percentage.
i.e, basically I want date to date comparison of my sales in the field.
i.e, Suppose I incur 2lakhs in 1st January 2018 and 5 Lakhs in 1st February 2018 what is % change between this date.
So how to extract dates from date column and compare this please explain.
Thanking You!!!
Regards,
Arvind.
Solved! Go to Solution.
Try this,
Variance% =
VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)
Hi @arvindyadav,
For Month to Month Percent Change, please see an example in this blog: Measures – Month to Month Percent Change.
Best Regards,
Angelia
Hi @angelia,
The link that you shared it is not working. Please, can you suggest any dax for the same?
Regards,
Arvind
Try this,
Variance% =
VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)
Hi @SivaMani,
In your case can you please suggest me how to first find previous month value and then I will apply the Dax formula that was you provided to me.
Regards,
Arvind.
Hi @SivaMani,
The formula given by you for the previous month is not working.
Please find attached file.
Regards,
Arvind.
Hi @SivaMani,
Got answer thank you so much.
Last doubt how you got _PREV_MONTH in this formula.
Variance% =
VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)
Regards,
Arvind
CALCULATE has two parts,
The expression will be evaluated based on the filters. In this case, DATEADD will give me previous month date. So, CALCULATE will give me the value of the previous month.
That's how it works.
It's working fine for me.
Can you share the error details?
If possible, share the pbix as well.