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
Rup10
Resolver I
Resolver I

Help with DAX Formula

Hi,

 

I have to add custom column called "last week" with the following expression : 

(departure_ >= date_add(current_date(), -$Weeks (4)*7) and departure<current_date())

 

Can someone please help me with dax expression.

Thanks in advance.

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

Hi, @Rup10 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

e1.png

 

You may create a measure as below.

 

 

Visual Control = 
IF(
    MAX('Table'[Departure])>=TODAY()-28&&
    MAX('Table'[Departure])<TODAY(),
    1,0
)

 

 

 

Then you may put the measure in the visual level filter to filter the result.

e2.png

 

Best Regards

Allan

 

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-alq-msft
Community Support
Community Support

Hi, @Rup10 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

e1.png

 

You may create a measure as below.

 

 

Visual Control = 
IF(
    MAX('Table'[Departure])>=TODAY()-28&&
    MAX('Table'[Departure])<TODAY(),
    1,0
)

 

 

 

Then you may put the measure in the visual level filter to filter the result.

e2.png

 

Best Regards

Allan

 

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

P_D_G
Resolver III
Resolver III

Hi,

could you please describe the exact logic of your calculation? What are you trying to achieve? Would this be an IF statement? It's easier to help if you can provide us with more context/background a sample dataset even?

 

Hi @amitchandak,

I am unable to understand that.But here i want how to find current_date and week.

Thank you

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.