Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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!