Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I have a table called 'Date Selection'. It has 2 columns, Week Number and Week Commencing
Now, in my report, I have a slicer which is based on 'Date Selection'[Week Commencing]. The use can only select 1 value.
When the user selects a value on the slicer, I want a measure which can store the related Week Number
Eg. User selects 'January 29, 2018', [MyMeasure] should be equal to 5
How would I do this?
Solved! Go to Solution.
Hi @shivkonar
You can create the desired measure with the following code:
Measure = MAX('Date Selection'[Week Number])
When the user selects a Week Commencing, the measure will return the specific Week Number associated with that selection. If you wanted to set a default value when no Week Commencing selection is made, that would just take a little more code.
Hope this helps,
Parker
Hi @shivkonar
You can create the desired measure with the following code:
Measure = MAX('Date Selection'[Week Number])
When the user selects a Week Commencing, the measure will return the specific Week Number associated with that selection. If you wanted to set a default value when no Week Commencing selection is made, that would just take a little more code.
Hope this helps,
Parker
@shivkonar Yep you're definitely on the right track. Whenever I am setting a default value I use this code:
IF( COUNTROWS(DISTINCT(ALLSELECTED('Table'[Column]))) = COUNTROWS(DISTINCT(ALL('Table'[Column]))), [Default Value], [Non-Default Value] )
There may be an easier way to do this but you are basically seeing if the number of rows in your selection is the same as the number of rows of the full table. If yes, then either no selection has been made or all of the options have been selected in which case you can use a default value.
Hope that makes sense,
Parker
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |