The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Measure Selection = SWITCH( TRUE(), VALUES('ADMIN Year Slicer'[Custom]) = "2015",[2015 Turnover Rate], VALUES('ADMIN Year Slicer'[Custom]) = "2016",[2016 Turnover Rate], VALUES('ADMIN Year Slicer'[Custom]) = "2017",[YTD Turnover Rate],BLANK() )
I'm using the SWITCH method outlined in this article -http://community.powerbi.com/t5/Community-Blog/Dynamically-change-the-information-within-a-visual-vi...
But I'm getting the error message above which I can't figure out. Here's the Measure selection table I'm using.
Any ideas why this is happening? Thanks,
Pierre
Solved! Go to Solution.
Hi @pierre415,
The VALUES function will return all the values of the 'ADMIN Year Slicer'[Custom] column if there is no any filter applied on it. So you may need to check if there is only one available value in current filter context first, then use VALUES('ADMIN Year Slicer'[Custom]) = "2015" within the SWITCH function in your scenario. The formula below is for your reference.
Measure Selection = IF ( HASONEVALUE ( 'ADMIN Year Slicer'[Custom] ), SWITCH ( TRUE (), VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2015", [2015 Turnover Rate], VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2016", [2016 Turnover Rate], VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2017", [YTD Turnover Rate], BLANK () ) )
Or you can just use FIRSTNONBLANK function instead of VALUES function.
Measure Selection = SWITCH ( TRUE (), FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2015", [2015 Turnover Rate], FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2016", [2016 Turnover Rate], FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2017", [YTD Turnover Rate], BLANK () )
Regards
Hi @pierre415,
The VALUES function will return all the values of the 'ADMIN Year Slicer'[Custom] column if there is no any filter applied on it. So you may need to check if there is only one available value in current filter context first, then use VALUES('ADMIN Year Slicer'[Custom]) = "2015" within the SWITCH function in your scenario. The formula below is for your reference.
Measure Selection = IF ( HASONEVALUE ( 'ADMIN Year Slicer'[Custom] ), SWITCH ( TRUE (), VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2015", [2015 Turnover Rate], VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2016", [2016 Turnover Rate], VALUES ( 'ADMIN Year Slicer'[Custom] ) = "2017", [YTD Turnover Rate], BLANK () ) )
Or you can just use FIRSTNONBLANK function instead of VALUES function.
Measure Selection = SWITCH ( TRUE (), FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2015", [2015 Turnover Rate], FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2016", [2016 Turnover Rate], FIRSTNONBLANK ( 'ADMIN Year Slicer'[Custom], 1 ) = "2017", [YTD Turnover Rate], BLANK () )
Regards
It works thank you!
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
30 |
User | Count |
---|---|
181 | |
82 | |
67 | |
48 | |
44 |