Forum Discussion
SWITCH in Slicer
Hi,
I have 3 different columns (flags) in my Dim_Date (ThisYear, ThisMonth, ThisWeek) they are eighter 0 or 1.
Now, instead of have this 3 shown as filter in my report i have build a new table with a column (DateFilter) and measures YTD,MTD,WTD. This column should be used as a slicer in report.
So a need a measure (Dax) when i select YTD in my DateFilter it should also "select" trigg Dim_Date[ThisYear]=1 and so on.
Here is a pic for clarify:
7 Replies
- amitchandak
Super User
Stabben23 , not very clear. refer these approches
or
measure slicer
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115
https://www.youtube.com/watch?v=vlnx7QUVYME - AlB
Community Champion
Hi Stabben23
Please share a pbix with the model that you describe above in order to clarify.
You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- Stabben23
Helper I
Hi @AIB,
Will not share my pbix, My model is a starschema with one to many to the fact table.
The Table that I create is not connected to the model.
- amitchandak
Super User
Stabben23 , do you need these columns
This Week = Switch( True(),
WEEKNUM('Datedim'[Date] ) = WEEKNUM( TODAY() ),1 ,
0
)This Month = Switch( True(),
Date([Date])= eomonth(Today(),0),1 ,
0
)This Year = Switch( True(),
year([Date])= year(Today()),1 ,
0
)- Stabben23
Helper I
Hi amitchandak
No I all ready have my Columns ThisYear, ThisMonth, ThisWeek. No I want to select ex. YTD in DateFilter and this should affect ThisYear =1.
Something simular like this but it's not working here:
switch(true(),VALUES('Measure_Dates'[DateFilter])="YTD",Calculate(SELECTEDVALUE(Dim_Datum[ThisYear]),Dim_Datum[ThisYear]="1"), ....a.s.o
- amitchandak
Super User
Stabben23 , Still did not get what you are trying. If you are trying that if you selected YTD and it should check 1 in this year. I doubt that can happen.
But if you check "this year" and YTD , MTD or WTD to consider that it can happen.
- Stabben23
Helper I
amitchandak , yes, when I select YTD then report should act as a select ThisYear=1.
So its not even possible with some if(iscrossfiltred syntax to achive this?
My solution right now is with Buttons and Bookmarks, but not happy with it.