Forum Discussion
SELECTEDVALUE not working after adding countries into the matrix
Hi Experts,
I need your help, i've been trying to figure this out but can't seem to wrap my head around it.
Firstly i have a simple matrix table showing the Year, Country and Total Sales by country:
Second i then add a measure to show me what the slicers are currently filtering based on the year slicer.
Test to delete =
VAR SelectedYear = SELECTEDVALUE(DimDate[Year])
VAR SPLYYear = SelectedYear - 1
RETURN
SelectedYear
Third this is the result of adding that measure to the matrix. Some countries were able to detect what the Year Slicers (Eg: Argentina, Brazil) but some were not able to.
Please help, the reason why i want to use selectedvalue, is because SAMEPERIOD function isn't working. as we don't have cotiguous dates.
Appreciate any help or ideas.
2 Replies
- amitchandak
Super User
Anonymous , does those countries have last year data ?
You can get last year like
//Only year vs Year, not a level below
This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA- AnonymousNot applicable
Here is a snapshot of my data model
BR