March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I'm trying to create a calculated colunm that groups dates into one of three values.
Current Month - all dates that are in this month
Previous Month - all dates in previous month
Historic - all dates in the past that do not meet the criteria above.
Is this even possible? if so how would i go about writing this Dax?
Solved! Go to Solution.
Hi @Anonymous
try column
=
IF(
AND(MONTH('Table'[DateColumn])=MONTH(today());YEAR('Table'[DateColumn])=YEAR(today()));
"Current Month";
IF(
AND(MONTH('Table'[DateColumn])=MONTH(EOMONTH(today();-1));YEAR('Table'[DateColumn])=YEAR(EOMONTH(today();-1)));
"Previous Month";
"Historic"
)
its possible also to add check if "future period"
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hello guys @az38 , Ihave decoded the error. the formula is a follows.
MTD FILTER =
IF(
MONTH('INV1 Invoice Rows'[DocDate])=MONTH(today())&& YEAR('INV1 Invoice Rows'[DocDate])=YEAR(today()),
"Current Month",
IF(
MONTH('INV1 Invoice Rows'[DocDate])=MONTH(EOMONTH(today(),-1))&&YEAR('INV1 Invoice Rows'[DocDate])=YEAR(EOMONTH(today(),-1)),
"Previous Month",
"Historic"
))
Hi @Anonymous
try column
=
IF(
AND(MONTH('Table'[DateColumn])=MONTH(today());YEAR('Table'[DateColumn])=YEAR(today()));
"Current Month";
IF(
AND(MONTH('Table'[DateColumn])=MONTH(EOMONTH(today();-1));YEAR('Table'[DateColumn])=YEAR(EOMONTH(today();-1)));
"Previous Month";
"Historic"
)
its possible also to add check if "future period"
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @az38,
Thanks for this, i've added in the table and colunm names and i keep on getting error messages. Would i need to have a date table?
Please see my Dax below.
Hi @Anonymous
what kind of error?
it works good in my demo-project.
do not hesitate to give a kudo to useful posts and mark solutions as solution
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
165 | |
116 | |
63 | |
57 | |
50 |