Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I want to use a slicer for a sample table who are not linked to any other one.
EX: table 1
Column1
Choice 1
Choice 2
Choice 3
In an other table I want to create a column who change dependent the value of the slicer.
I used selectedvalue like this:
column = if(selectedvalue(Table1[Column1]) = "Choice 1", true, false)
If I select in the slicer "Choice 1" The result are "False".
If I create a measure with the same syntax it's work? But I need to populate a column not a measure.
How can I do that?
Hi @vbourbeau ,
You cannot make a calculated column value change according to the selection on a slicer, believe that you want to make this new column to present on a visual, so you need to make it with a measure.
Measures are calculated based on context that can be given by a number of elements including the Slicer.
Can you give a little more insight on how you want to use the result of the calculation so I can help you better.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsOk look this example, it's what I'm tying to do. But in my real data I have more table to filter. So if I click on "last week" both table will filter for the last week result. I don't want to create new amount measure on each table because in reality I have 10 tables.
What I've trying it's create a column in the Date dimension who change value depending the slicer choice and add a page filter for that column.
I put my example here https://we.tl/t-Q6hNDlJyXq
Hi @vbourbeau ,
Looking at your model since you have the tables connect trough date table create the following measure:
Filter Dates = SWITCH ( TRUE (); SELECTEDVALUE ( 'Time'[Sequence] ) = 1; FILTER ( SUMMARIZE ( Dates; Dates[Date] ); Dates[Date] <= TODAY () && Dates[Date] >= TODAY () - 7 ); SELECTEDVALUE ( 'Time'[Sequence] ) = 2; FILTER ( SUMMARIZE ( Dates; Dates[Date] ); Dates[Date] <= TODAY () && Dates[Date] >= TODAY () - 84 ); SELECTEDVALUE ( 'Time'[Sequence] ) = 3; FILTER ( SUMMARIZE ( Dates; Dates[Date] ); Dates[Date] <= TODAY () && Dates[Date] >= TODAY () - 365 ) )
Then add this as a filter on your tables and select the option not blank final result will be the following:
Check the PBIX file attach.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi,
When I put the same logic in my full report I've got this message:
"A table of multiple values was supplied where a single value was expected"
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsFilter Dates = SWITCH ( TRUE (); SELECTEDVALUE ( Temps[Sequence] ) = 1; FILTER ( SUMMARIZE ( DatesFull;DatesFull[Dates] ); DatesFull[Dates] <= TODAY () && DatesFull[Dates] >= TODAY () - 7 ); SELECTEDVALUE ( Temps[Sequence] ) = 2; FILTER ( SUMMARIZE ( DatesFull;DatesFull[Dates] ); DatesFull[Dates] <= TODAY () && DatesFull[Dates] >= TODAY () - 84 ); SELECTEDVALUE ( Temps[Sequence] ) = 3; FILTER ( SUMMARIZE ( DatesFull;DatesFull[Dates] ); DatesFull[Dates] <= TODAY () && DatesFull[Dates] >= TODAY () - 365 ) )
If I create a table with :
FILTER ( SUMMARIZE ( DatesFull;DatesFull[Dates] ); DatesFull[Dates] <= TODAY () && DatesFull[Dates] >= TODAY () - 7 )
I've got:
You see it's missing 2 days because of the week end. Maybe it's the cause...
I changed my Date dimension to be sure to have continus date but still have the same problem.
Hi @vbourbeau ,
Are you creating a calculate column or measure? you must use a measure not a column.
Is it possible for you to share your file trough private message? sometimes the context changes the way calculations are made.
Regarding the weekend you just need to adjust the calculation I have made one week from today but if you want the full week of the current date, some adjustments need to be made.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @vbourbeau ,
You issue is relatwed to the fact that if you have 5 types and if you select one that is not on the switch measure it will give you error, you need to add the other option to the switch formula or add an IFERROR so that it does not return error.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsI put the exact same number on the switch the problem still there.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |