Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

New column from date until variable date + conditions

Hi all,

 

I need to create a new column that is either 0 or 1 based on some criteria:

If date named posting date is equal to or greater than 18-01-2021

and If category named initiative <> "active"

and If category named  items = "finetune"

If all criteria is met then 1 else 0

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

you could use M lanuage by the following:

 

if [Posting Date]>=#date(2021,1,18) and [Price Initiative]="Finetune" and [Initiative Period]<>"Active"then 1 else 0

 

v-yalanwu-msft_0-1623306983875.png

and another custom column as follows:

let _a=[Business Unit]
in List.Min(
    Table.SelectRows(#"Changed Type",each [Initiative Period] = "Active"
            and [Price Initiative] = "Finetune" and [Business Unit]=_a)[Posting Date])

v-yalanwu-msft_2-1623308448424.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

 

View solution in original post

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

you could use M lanuage by the following:

 

if [Posting Date]>=#date(2021,1,18) and [Price Initiative]="Finetune" and [Initiative Period]<>"Active"then 1 else 0

 

v-yalanwu-msft_0-1623306983875.png

and another custom column as follows:

let _a=[Business Unit]
in List.Min(
    Table.SelectRows(#"Changed Type",each [Initiative Period] = "Active"
            and [Price Initiative] = "Finetune" and [Business Unit]=_a)[Posting Date])

v-yalanwu-msft_2-1623308448424.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

 

Anonymous
Not applicable

There is still something wrong with the custom formula.. =/

kolovez_1-1623158892350.png

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

you can try the following calculated column:

New Column =
IF(
      myTable[Date] >= DATE(2021,01,18)
    && myTable[category named initiative] <> "active"
    && myTable[category named items] = "finetune",
    1,
    0
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

Thanks, I think it worked.

However i have this other column that was created using a measure and not created inside the edit query, which now doesn't work anymore.

Could you please help me also create a custom column with these criteria:

Min. Date Active Finetune =
MINX (
FILTER (
Initiativemonitor_table,
EARLIER ( Initiativemonitor_table[Business Unit] ) = Initiativemonitor_table[Business Unit]
&& Initiativemonitor_table[Initiative Period] = "Active"
&& Initiativemonitor_table[Price Initiative] = "Finetune"
),
Initiativemonitor_table[Posting Date]
)


Basically, I need to have a column that writes the minimum posting date where the criteria is met:
Initiativemonitor_table[Price Initiative] = "Finetune"
Initiativemonitor_table[Initiative Period] = "Active"

per business unit.

So for different business units there would be a different minimum posting date.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.