Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Evening,
I'm trying to create a column for dates which will show different categorisations depending upon the date range. The date ranges aren't within my table and I'm trying to code them into the M/column.
When I attempted to create the column in the report view with the code it returns "returns multiple values":
Tester2021 = IF(DATESBETWEEN('itemdetailsdogfood$'[Date], DATE(2017,1,1), DATE(2017,7,15)),"Term Time", "Normal")When I create the custom column in the query editor, I'm not sure of the syntax for M:
if([Date] > DATE(2017,1,1) < DATE(2017,7,15), "Term Time", "Normal")
Thoughts or suggestions? I've searched the forums and the internet to no avail. I've had a look at the M reference, but that seems to be focused upon power query as opposed to the M used in Custom Columns.
Solved! Go to Solution.
Hi @ElliotP,
Add a custom column with the following code:
= if [Date] >= #date(2017, 1, 1) and [Date] <= #date(2017, 7, 15) then "Term Time" else "Normal"
The M code is:
= Table.AddColumn(#"Renamed Columns", "Custom.1", each if [Date] >= #date(2017, 1, 1) and [Date] <= #date(2017, 7, 15) then "Term Time" else "Normal")
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @ElliotP,
Add a custom column with the following code:
= if [Date] >= #date(2017, 1, 1) and [Date] <= #date(2017, 7, 15) then "Term Time" else "Normal"
The M code is:
= Table.AddColumn(#"Renamed Columns", "Custom.1", each if [Date] >= #date(2017, 1, 1) and [Date] <= #date(2017, 7, 15) then "Term Time" else "Normal")
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThank you so much, I greatly appreciate it.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 38 | |
| 29 | |
| 27 |