Forum Discussion
Julien_F
Helper I
7 years agoQUICk MEASURE FAILED
Hello,
WHat is wrong here
Gross YoY% =
IF(
ISFILTERED('BNP_FINANCIAL_NIELSEN_OUTPUT'[PUB_DATE]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
VAR __PREV_YEAR =
CALCULATE(
SUM('BNP_FINANCIAL_NIELSEN_OUTPUT'[Gross]),
DATEADD('BNP_FINANCIAL_NIELSEN_OUTPUT'[PUB_DATE].[Date], -1,YEAR)
)
RETURN
DIVIDE(
SUM('BNP_FINANCIAL_NIELSEN_OUTPUT'[Gross]) - __PREV_YEAR,
__PREV_YEAR
)
)
It said year syntax is not correct!
:/
In case you need this year vs Last year
On the Fly Change % = Var _last_year= year(max('Date'[Date Filer]))-1 Var _This_year=year(max('Date'[Date Filer])) Var _last_year_val= CALCULATE(sum(Sales[Sales Amount]),YEAR(Sales[Sales Date])=_last_year) Var _This_year_val =CALCULATE(sum(Sales[Sales Amount]),YEAR(Sales[Sales Date])=_This_year) return (_This_year_val-_last_year_val)/_last_year_val*100
17 Replies
- amitchandak
Super User
I think it because of
CALCULATE( SUM('BNP_FINANCIAL_NIELSEN_OUTPUT'[Gross]), DATEADD('BNP_FINANCIAL_NIELSEN_OUTPUT'[PUB_DATE].[Date], -1,YEAR) )The second parameter should be a filter example
2nd last year = CALCULATE(sum(Sales[Sales]),OrderTime[Order Year]= CONCATENATE( Year(NOW())-2,""))
- Julien_F
Helper I
Maybe...
But I used quick measure so does it mean PBI did it wrong?
parry2k I created a DIM_DATE to be sure but still have the same prob
Gross YoY% =IF(ISFILTERED('Table'[Date]),ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),VAR __PREV_YEAR =CALCULATE(SUM('BNP_FINANCIAL_NIELSEN_OUTPUT'[Gross]),DATEADD('Table'[Date].[Date], -1, YEAR))RETURNDIVIDE(SUM('BNP_FINANCIAL_NIELSEN_OUTPUT'[Gross]) - __PREV_YEAR,__PREV_YEAR))In red this what PBI said it is wrong ;)