The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi Team,
Greetings!
My requirement is I have employee Name, Employee location, Employee Designation in my slicer. if I select any slicer or all slicer (one value or multiple value) I want to show Max length of selected value Text number in my bar chart.
Example: Assume , are selected value of slicer. So based on my current selection my Bar chart would show the value of 6 as of Max length of selected slicer value is Carref = length of character is 6. Please give your suggestion how can we achieve this. Thanks for you help.
Employee Name | Employee location | Designation |
x , | kar , | xxx |
y , | bard , | yyy |
z , | carref , | zzz |
ff |
Solved! Go to Solution.
Hi @Singaravelu_R ,
You can create a measure as below, please find the attachment for the details.
Measure =
VAR _tab =
SUMMARIZE (
'Employee' ,
'Employee'[Employee Name],
'Employee'[Employee location],
'Employee'[Designation],
"_lenofename", LEN ( 'Employee'[Employee Name] ),
"_lenofelocation", LEN ( 'Employee'[Employee location] ),
"_lenofdesignation", LEN ( 'Employee'[Designation] )
)
VAR _lempname =
MAXX ( _tab, [_lenofelocation] )
VAR _lemplocation =
MAXX ( _tab, [_lenofelocation] )
VAR _ldesignation =
MAXX ( _tab, [_lenofdesignation] )
RETURN
MAX ( MAX ( _lempname, _lemplocation ), _ldesignation )
Best Regards
Hi @Singaravelu_R ,
You can create a measure as below, please find the attachment for the details.
Measure =
VAR _tab =
SUMMARIZE (
'Employee' ,
'Employee'[Employee Name],
'Employee'[Employee location],
'Employee'[Designation],
"_lenofename", LEN ( 'Employee'[Employee Name] ),
"_lenofelocation", LEN ( 'Employee'[Employee location] ),
"_lenofdesignation", LEN ( 'Employee'[Designation] )
)
VAR _lempname =
MAXX ( _tab, [_lenofelocation] )
VAR _lemplocation =
MAXX ( _tab, [_lenofelocation] )
VAR _ldesignation =
MAXX ( _tab, [_lenofdesignation] )
RETURN
MAX ( MAX ( _lempname, _lemplocation ), _ldesignation )
Best Regards
Hey @Singaravelu_R ,
create a measure for each sllicer in your report
slicer 1 =
MAXX(
VALUES( 'tablename'[columnname] )
, var __columnValue = 'tablename'[columnname]
var __columnValueLength = LEN( __columnValue )
return
__columnValueLength
)
You may want to differentiate if at least one item inside the slicer is selected, and for this you can consider to incorporate the function ISFILTERED(...) like so.
slicer 1 =
IF( ISFILTERED( 'tablename'[columnname] )
, ...
, BLANK()
)
Finally create a measure that returns the MAX value from all the measures like so:
max length =
MAX( [sllicer 1] , [slicer 2] , ... , [slicer n] )
Use the measure [max length] for your data visualization.
Of course it's also possible to create just one measre using variables, that store the value for each slicer, the final operation is then is to get the MAX from the variables, this is of course depends on your likings.
Personally I try to reduce the number of measures, but also try to keep each measure as short as possible.
Hopefully, this helps to tackle your challenge.
Regards,
Tom