Forum Discussion
Anonymous
9 years agoNot applicable
Need help to write DAX measure
Hello All, I am a newbie to PowerBI and DAX. I need your valueable suggestions and triks to solve the below query. I would like to compare the current month(May-2017) Sales value(40) wi...
Anonymous
9 years agoNot applicable
Wow that was huge Greg_Deckler.
I didnt expected that.
But while I am trying this i got some issues here.its giving me a wrong result then i changed it into
But then When i tried the next one, theres lots of errors.
thanks for the quick reply.
Its really huge for me.
Greg_Deckler
Community Champion
9 years agoSorry, that's what I get when trying to write DAX without testing.
Try this:
MyMeasure = var CurrentYearMonth = VALUE(CONCATENATE(YEAR(TODAY()),MONTH(TODAY()))) RETURN IF(ISBLANK(CALCULATE(SUM([Sales]),FILTER(Sales,[YearMonth]=CurrentYearMonth-1))), CALCULATE(SUM([Sales]),FILTER(Sales,[YearMonth]=CurrentYearMonth)) - CALCULATE(SUM([Sales]),FILTER(Sales,[YearMonth]=CurrentYearMonth-2)), CALCULATE(SUM([Sales]),FILTER(Sales,[YearMonth]=CurrentYearMonth)) - CALCULATE(SUM([Sales]),FILTER(Sales,[YearMonth]=CurrentYearMonth-1)) )
- Anonymous9 years agoNot applicable