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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
cris1196
Helper I
Helper I

How can I change value after a date in Dax?

Hello. I am having problems, I have the following table:

cris1196_0-1662589151117.png

If ID=1, the user has a house. If ID=2, you have a car. Opposite case, has a plane. The "DATA" table can be filtered with dates thanks to a table called DATE.

 

Fred, after March 15, 2022, sold his house and bought a car, consequently, he would belong to ID=2. The result I want is the following:

cris1196_1-1662589300101.png

 

I couldn't get those two values to change from house-->car

Just in case: this is what i was trying:

 

Measure =
var SelectType=value(selectedvalue('DATE'[NAME])
var is_house=SelectType=1
var is_car=SelectType=2
var is_plane=not(is_house || is_car)
//With that, I manage to select the 3 types of data that I need

var SelectNames=selectedvalue('DATA'[Name])
var StartDate=DATE(2022, 03, 15)
var SelectDay=selectedvalue('DATE'[Day])

//With this, the idea is to use it later to say "if the date is greater than StartDate, I want to [specify what I want] result"

return
if(is_house, "House",
if(is_car, if(Selectday>StartDate, if(SelectNames="Fred", "Car",
//IF it is car, then IF the date is after StartDate AND IF the name is Fred, then it is changed to "Car"
if(is_car, "Car",
if(is_plane, "Plane"
))))))

 

Until now, everything I found on the Internet was related to what they wanted to add between dates, I did not find something similar to my problem.

 

Any idea is welcome 😔




1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @cris1196 ,

 

vcgaomsft_0-1662614700642.png

Is this the only table you have for original data? All sales purchase records need to be manually go through the parameters in Dax? Creating measures like this can be very difficult to maintain in code later.

 

A better solution would be to organize all buy and sell records into a fact table and create a relationship with the date column of the calendar table, so that the problem becomes much easier.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @cris1196 ,

 

vcgaomsft_0-1662614700642.png

Is this the only table you have for original data? All sales purchase records need to be manually go through the parameters in Dax? Creating measures like this can be very difficult to maintain in code later.

 

A better solution would be to organize all buy and sell records into a fact table and create a relationship with the date column of the calendar table, so that the problem becomes much easier.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

"A better solution would be to organize all buy and sell records into a fact table and create a relationship with the date column of the calendar table, so that the problem becomes much easier."

 

Yes, I did that. Much more comfortable. Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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