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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
CJ_96601
Helper V
Helper V

Tag a record

Can someone help me on how to tag a record in power bi query using filter.

 

Ex:

 

count records if order date <= calendar and delivery date is > calendar - tag the record late delivery and so on

 

thanks

 

1 ACCEPTED SOLUTION

Hi @CJ_96601 ,

 

There is a problem. If you' like a column in Power Query, you have to assign the date to use. In other words, you can't make it dynamic. Since you need a column, there could be two solutions.

1. A calculated column with DAX.

 

test =
IF (
     'sales'[order date]  <= TODAY ()
        && 'sales'[delivery date] > TODAY (),
    "Late Delivery",
    "Normal"
)

2. A new column with Power Query.

 

 

if [order date] <= DateTime.LocalNow() and [delivery Date] > DateTime.LocalNow() 
then "Late Delivery"
else "Normal"

 

 

Best Regards,

Community Support Team _ Dale
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

9 REPLIES 9
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @CJ_96601 ,

 

If you'd like to show them in a report, please try out this measure. 

 

test =
IF (
    MIN ( 'sales'[order date] ) <= TODAY ()
        && MIN ( 'sales'[delivery date] ) > TODAY (),
    "Late Delivery",
    "Normal"
)

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thanks.

 

Instead of today, i need to have a variable date, in filter.

 

Regards, 

 

 

Obet

 

 

Hi Obet,

 

You can try this one in that case.

 

test =
VAR selectedDate =
    IF (
        ISBLANK ( SELECTEDVALUE ( 'Calendar'[Date] ) ),
        TODAY (),
        SELECTEDVALUE ( 'Calendar'[Date] )
    )
RETURN
    IF (
        MIN ( 'sales'[order date] ) <= selectedDate
            && MIN ( 'sales'[delivery date] ) > selectedDate,
        "Late Delivery",
        "Normal"
    )

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks.  can i use power query or measure?

Hi @CJ_96601 ,

 

Could you please mark the proper answers as solutions?

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thanks, but it is not the solution i am looking for.

 

I need the tag in additional column, in power query

 

regards, 

 

Hi @CJ_96601 ,

 

There is a problem. If you' like a column in Power Query, you have to assign the date to use. In other words, you can't make it dynamic. Since you need a column, there could be two solutions.

1. A calculated column with DAX.

 

test =
IF (
     'sales'[order date]  <= TODAY ()
        && 'sales'[delivery date] > TODAY (),
    "Late Delivery",
    "Normal"
)

2. A new column with Power Query.

 

 

if [order date] <= DateTime.LocalNow() and [delivery Date] > DateTime.LocalNow() 
then "Late Delivery"
else "Normal"

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks.

 

 

My pleasure. It's a measure.

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors