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.
I am trying to create a table from another table and would like to pad one of the columns with leading zeros.
I am using:
SUMMARIZE(products,products[Appl_No])
and would like the column [Appl_No] to be 6 digits, padding with zeros, if necessary.
Solved! Go to Solution.
hi, @pbeeyeqs
You could try this formula logic to create the new table
Table = SELECTCOLUMNS(SUMMARIZE(Table1,Table1[Column1]),"Column1", RIGHT("000000"&[Column1],6))
Best Regards,
Lin
You can add a conditional column with dax like this:
AppLeading0 =
If( Len( products[Appl_No]) = 1 ; 00000 & products[Appl_No];
If( Len( products[Appl_No]) = 2 ; 0000 & products[Appl_No];
If( Len( products[Appl_No]) = 3 ; 000 & products[Appl_No];
If( Len( products[Appl_No]) = 4 ; 00 & products[Appl_No];
If( Len( products[Appl_No]) = 5 ; 0 & products[Appl_No];
If( Len( products[Appl_No]) = 6 ; products[Appl_No]; "Invalid length" ))))))
I know it will not be the most beautyfull solution, but it will do the job. 🙂
So, having issues:
To create the table with 2 columns using summarize, can't figure out how to get the 2nd column. So far I have:
=SUMMARIZE(table1,table1[column])
Which is fine for the first column. How can I add to this to make the 2nd column to be the same as the first column with padding to make 6 characters in length?
COLUMN 1 COLUMN 2
14325 014325
22 000022
415263 415263
ABC 000ABC
hi, @pbeeyeqs
You could try this formula logic to create the new table
Table = SELECTCOLUMNS(SUMMARIZE(Table1,Table1[Column1]),"Column1", RIGHT("000000"&[Column1],6))
Best Regards,
Lin
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |