Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AjjuSid
Contributor III
Contributor III

Alignment Formatting - Two Expression in a single field(Measure).

Hi All, 

I have two expression  which I am concatenating into one in a Expression tab. 

Do we have workaround such that the First expression values are left Aligned and the 2nd Expression values are right aligned? Such that it looks much more cleaner.

Some thing like this:

                                              ProductName

                                             Exp1&'  '&Exp2

                                             $20              35%

                                             $5                90%

                                             $1300        180%     

right Now it looks 

                                             Exp1&'  '&Exp2

                                             $20          35%

                                           $5             100%

                                      $100                  6%

Note: Both Exp1 and Exp2 are in a same Expression tab and are saperated using &'    '&

 

Thanks a lot for your help.

 

@seshubabu @ Danielrozental @edwin 

 

Labels (1)
1 Solution

Accepted Solutions
krishna_2644
Specialist III
Specialist III

Step 1: insert this piece of code in your load statement

len(price) as len_pr,

step 2: create variable 

Set vMaxpriceLen  = max(len_pr)

step 3: in the chart/table, Use Expression:

= if(len_pr <= vMaxpriceLen,
         if(len_pr = 2,
             price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr + 2) & percent,
            if(len_pr = 3,
               price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr + 1) & percent,
              price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr) & percent)))

please check attached. 

View solution in original post

4 Replies
krishna_2644
Specialist III
Specialist III

Hi - This may not be an ideal solution but works for your case here.

Capture.JPG

AjjuSid
Contributor III
Contributor III
Author

@krishna_2644 ,Thanks for your reply. 

But I was not able to completely follow your solution. 

In the Expression part, are you asking me to do a left Alignment. If yes, I tried but it doesn't work. 

Can you please elaborate the solution. 

Thanks again for your help. 

 

krishna_2644
Specialist III
Specialist III

Step 1: insert this piece of code in your load statement

len(price) as len_pr,

step 2: create variable 

Set vMaxpriceLen  = max(len_pr)

step 3: in the chart/table, Use Expression:

= if(len_pr <= vMaxpriceLen,
         if(len_pr = 2,
             price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr + 2) & percent,
            if(len_pr = 3,
               price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr + 1) & percent,
              price & Repeat(Chr(160),vMaxpriceLen + 2 - len_pr) & percent)))

please check attached. 

AjjuSid
Contributor III
Contributor III
Author

@krishna_2644 , It Worked, Thanks a lot for your help.