The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I have one column which contains version of softwares like below
3.1.7.12
3.1.7.14
2.6.5
2.6.8
27.4.12.8
and so on...
My question is how can I format each numbers between two points to have every time 2 digits ? So:
03.01.07.12
03.01.07.14
02.06.05
02.06.08
27.04.12.08
Is it possible to do that with dax formulas ?
Sébastien
Solved! Go to Solution.
Hi @Hussard,
Based on my test, you could refer to below steps:
Sample data:
Create 5 columns:
B = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1))<2,"0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1),PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1)))
C = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2),PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2)))
D = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3),"."&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3)))
E = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4),"."&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4)))
New A = Table2[B]&Table2[C]&Table2[D]&Table2[E]
Result :
You could also download the pbix file to have a view.
Regards,
Daniel He
Hi @Hussard
The following way you can get your solution easily.
I have given the Sample Pbix file link below. Hope this helps you.
Hi @Hussard
The following way you can get your solution easily.
I have given the Sample Pbix file link below. Hope this helps you.
Hi both,
Thanks a lot I tried both solutions and it suits me.
Regards
Sébastien
Hi @Hussard,
Based on my test, you could refer to below steps:
Sample data:
Create 5 columns:
B = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1))<2,"0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1),PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 1)))
C = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2),PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 2)))
D = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3),"."&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 3)))
E = IF(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4)=BLANK(),BLANK(),IF(LEN(PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4))<2,".0"&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4),"."&PATHITEM(SUBSTITUTE('Table2'[A],".", "|"), 4)))
New A = Table2[B]&Table2[C]&Table2[D]&Table2[E]
Result :
You could also download the pbix file to have a view.
Regards,
Daniel He
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
79 | |
70 | |
48 | |
41 |
User | Count |
---|---|
139 | |
112 | |
72 | |
64 | |
62 |