Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi, im trying to do a filter where i choose the day and the chart show me the entire weekend(for example, with i choose february 27, the chart have to plot from february 25 until march 1, those are the dates of the 9 week of the year)
Solved! Go to Solution.
Try this:
1. Create a calculated table to use as slicer with the dates you need (update the code as required):
SlicerTable = VAR _InitialDate = DATE ( 2018, 01, 01 ) VAR _LastDate = DATE ( 2018, 12, 31 ) RETURN CALENDAR ( _InitialDate, _LastDate )
2. Place SlicerTable[Date] in a slicer
3. Place 'Date'[Date] in the axis of the chart as you were already doing and create a measure like this:
AuxMeasure = IF ( WEEKNUM ( SELECTEDVALUE ( 'Date'[Date] ), 2 ) = WEEKNUM ( SELECTEDVALUE ( SlicerTable[Date] ), 2 ), [YourMeasureHere] )
where [YourMeasureHere] is whatever you want to use to be shown on the chart. What [AuxMeasure] does is return [YourMeasureHere] when the date in the axis is in the same week as the date selected in the slicer and blank otherwise. Therefore, only the dates in the selected week will be shown.
Let me know if that helps
i Found a way to solve my problem
1. I created a table with all weeknum(Named this column as Week_NUM) and weekday(Named this column as Day) from the entire year and didnt make any relationship between the tables (named this new table as Table2)
2. Secondly i created this measure
Hi,
Why would you not want to selec the week in the date slicer? Why complicate things by just selecting a date.
We share the same thought, the problems is that the client asked for this specific in that way(first of all i tried to suggest a week filter, but he told me that would be worst)
i Found a way to solve my problem
1. I created a table with all weeknum(Named this column as Week_NUM) and weekday(Named this column as Day) from the entire year and didnt make any relationship between the tables (named this new table as Table2)
2. Secondly i created this measure
Try this:
1. Create a calculated table to use as slicer with the dates you need (update the code as required):
SlicerTable = VAR _InitialDate = DATE ( 2018, 01, 01 ) VAR _LastDate = DATE ( 2018, 12, 31 ) RETURN CALENDAR ( _InitialDate, _LastDate )
2. Place SlicerTable[Date] in a slicer
3. Place 'Date'[Date] in the axis of the chart as you were already doing and create a measure like this:
AuxMeasure = IF ( WEEKNUM ( SELECTEDVALUE ( 'Date'[Date] ), 2 ) = WEEKNUM ( SELECTEDVALUE ( SlicerTable[Date] ), 2 ), [YourMeasureHere] )
where [YourMeasureHere] is whatever you want to use to be shown on the chart. What [AuxMeasure] does is return [YourMeasureHere] when the date in the axis is in the same week as the date selected in the slicer and blank otherwise. Therefore, only the dates in the selected week will be shown.
Let me know if that helps
@AlB that worked with this chart, but the problem is that i have more charts in that page, and when i create the relationship(one-many in both directions) to make the SlicerTable my filter date, that doesnt work anymore
@Anonymous
You would have to replicate the same pattern in every chart cause this type of filtering as you propose it is not supported natively in DAX. Another option would be to create a table with weeks and days and use it as a slicer but selecting the week instead of the day in the slicer. Then create a relationship between the days in the slicer and the days in the axis of the charts
User | Count |
---|---|
128 | |
108 | |
99 | |
65 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |