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

Be 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

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?

 

amitchandak
Super User
Super User

@Rup10 , for week on week, refer my blogs of video

 

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak,

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

Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.