Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi,
I am trying to add a column via Power Query M. How do I convert this DAX code to M language:
IF (
YEAR ( 'Dummy Data'[Admissions Month] )
= YEAR ( DATE(YEAR(TODAY()),
MONTH(TODAY())-1,DAY(TODAY())) )
&& MONTH ( 'Dummy Data'[Admissions Month] ) = MONTH ( DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())) ),
"Last Month",
'Dummy Data'[Admissions Month]
)
Thanks for your help.
Solved! Go to Solution.
Hi @JohnNPBIUser ,
I think you can hugely simplify this down to:
if Date.StartOfMonth([AdmissionsMonth]) = Date.StartOfMonth(Date.AddMonths(Date.From(DateTime.LocalNow()), -1))
then "Last Month"
else [AdmissionsMonth]
Pete
Proud to be a Datanaut!
Thank you for your help, much appreciated 👍
Hi @JohnNPBIUser ,
I think you can hugely simplify this down to:
if Date.StartOfMonth([AdmissionsMonth]) = Date.StartOfMonth(Date.AddMonths(Date.From(DateTime.LocalNow()), -1))
then "Last Month"
else [AdmissionsMonth]
Pete
Proud to be a Datanaut!
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 6 |