Forum Discussion
Saibal_78
Helper I
3 years agoMultiple KPIs with line break using BUTTON and SHAPE
Hi All,
I am trying to create a custom multiline KPIs using button/shape, below are my DAX codes, note I am not using card as left alignment is not possible in card. Any help would be highly appreciated.
Button/shape details:-
Button width = 350
Button height = 300
Monospace font used = Consolas
Horizontal Alignment of text = Left
Vertical Alignment of text = Top
DAX :-
Information Analytics1 =
VAR Space = " "
VAR CardWidth = 350
VAR Max_Text_Length = 45
VAR KPI1_Text = "Project Name :"
VAR KPI2_Text = "BOM :"
VAR KPI3_Text = "Region :"
VAR KPI4_Text = "NPV :"
VAR KPI5_Text = "IRR :"
VAR KPI1_Value = [ProjectName]
VAR KPI2_Value = [ProjectBOM]
VAR KPI3_Value = [ProjectRegion]
VAR KPI4_Value = [ProjectNPV]
VAR KPI5_Value = [ProjectIRR]
VAR KPI1_NumberOfSpaces_Left = Max_Text_Length - LEN(KPI1_Text)
VAR KPI2_NumberOfSpaces_Left = Max_Text_Length - LEN(KPI2_Text)
VAR KPI3_NumberOfSpaces_Left = Max_Text_Length - LEN(KPI3_Text)
VAR KPI4_NumberOfSpaces_Left = Max_Text_Length - LEN(KPI4_Text)
VAR KPI5_NumberOfSpaces_Left = Max_Text_Length - LEN(KPI5_Text)
VAR KPI1_NumberOfSpaces_Right = CardWidth - LEN(KPI1_Text)
VAR KPI2_NumberOfSpaces_Right = CardWidth - LEN(KPI2_Text)
VAR KPI3_NumberOfSpaces_Right = CardWidth - LEN(KPI3_Text)
VAR KPI4_NumberOfSpaces_Right = CardWidth - LEN(KPI4_Text)
VAR KPI5_NumberOfSpaces_Right = CardWidth - LEN(KPI5_Text)
VAR SummaryText =
KPI1_Text & REPT(Space,KPI1_NumberOfSpaces_Left) & KPI1_Value & REPT(Space,KPI1_NumberOfSpaces_Right) &
KPI2_Text & REPT(Space,KPI2_NumberOfSpaces_Left) & KPI2_Value & REPT(Space,KPI2_NumberOfSpaces_Right) &
KPI3_Text & REPT(Space,KPI3_NumberOfSpaces_Left) & KPI3_Value & REPT(Space,KPI3_NumberOfSpaces_Right) &
KPI4_Text & REPT(Space,KPI4_NumberOfSpaces_Left) & KPI4_Value & REPT(Space,KPI4_NumberOfSpaces_Right) &
KPI5_Text & REPT(Space,KPI5_NumberOfSpaces_Left) & KPI5_Value
RETURN
SummaryText
This is the output i got using above measure However this is the output I want
Output I gotOutput I want
4 Replies
- rajulshah
Resident Rockstar
You can use the following DAX measure:
VAR SummaryText = KPI1_Text & REPT(Space,KPI1_NumberOfSpaces_Left) & KPI1_Value & REPT(Space,KPI1_NumberOfSpaces_Right) &UNICHAR(10)& KPI2_Text & REPT(Space,KPI2_NumberOfSpaces_Left) & KPI2_Value & REPT(Space,KPI2_NumberOfSpaces_Right) &UNICHAR(10)& KPI3_Text & REPT(Space,KPI3_NumberOfSpaces_Left) & KPI3_Value & REPT(Space,KPI3_NumberOfSpaces_Right) &UNICHAR(10)& KPI4_Text & REPT(Space,KPI4_NumberOfSpaces_Left) & KPI4_Value & REPT(Space,KPI4_NumberOfSpaces_Right) &UNICHAR(10)& KPI5_Text & REPT(Space,KPI5_NumberOfSpaces_Left) & KPI5_ValueUNICHAR(10) gives a line break.
Please let me know if this didn't help.
- Saibal_78
Helper I
No luck
- cmandradNew Member
I tried using the unichar(10) to add a line break to a Q&A action button and it didn't work
Do you know a workaround?