Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello,
I am working on some transformation, and I have found out behavior of PQ that I dont understand.
When I am using the code:
= List.Transform( Custom3{0}[Record], each if _ = "2024" or _ = "2023" or _ = "2022" or _ = "2021"or _ = "2020" then null else _ )
all is working as I want.
Now I wished to clean the code a bit so instead of listing the years 1 by 1 I decided to use List.Contains and List.Contains.Any
In it I decided to use numerical text {"2020".."2030"} and this gave me the error
the issue / question is how do I generate a range from 2020 to 2030 as text values.
also why cant I genare sequence of "2020" to "2030" ?
Hello,
Thank you all for answering,
Thank you for the methods presented and I was already aware of them.
I was hoping there is more direct way of doing this.
anmd that I am missing some basic detail on how to do it.
Thank you again
you can use this formula instead
=each List.Contains({"2022","2023","2024","2025","2026"}, _ )
The .. notation only works with integers or with single characters. For example {"A".."Z"} works but {"AA".."ZZ"} doesn't.
Create a numeric list {2020..2030} and then use Text.From(_)
= List.Generate(()=> 2020, each _ < 2031 , each _ +1, each Text.From(_))
or
= List.Transform({2020..2030},each Text.From(_))
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |