Forum Discussion
M-Query
Hi community,
Hope you all are doing well!
I've a doubt regarding Power BI M-query.
I've created an IF statement via Calculated column, which I'm looking to create in Power Query or Transform Query using M-Query.
Below is the IF statement:
11 Replies
- HotChilliCommunity Champion
You will need to Add a Custom Column in Power Query.
It will be a combination of an 'if' statement :
https://gorilla.bi/power-query/if-function-in-power-query/
and Text.Right
https://learn.microsoft.com/en-us/powerquery-m/text-end
You may need other Text functions:
https://learn.microsoft.com/en-us/powerquery-m/text-functions
because you may need to change some number fields to text so that you can use them.
You can combine text in power query with '&'.
My advice is start it simply (get something basic that works) and build it step by step adding logic
- Niraj_vora0106Helper III
Hi HotChilli
I tried using M-query text functions.
below is the snip of the code I tried for creating Fiscal Year:
Please help me out if I'm doing anything wrong in this.
Used Text.From to convert Number to Text. I converted Month and Year datatypes to Text also
Still getting error
below is the error snip:
Please help!
- PadycosmosSolution Sage
You may try Number.ToText
https://learn.microsoft.com/en-us/powerquery-m/number-totext