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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Tiago_Varela
Helper I
Helper I

IF DAX FORMULA WITH DATE

Hi all,

I want ot make a mesure but i can't get it right.

I want to say that If today is lower then (criation date) then it should do the formula (rn_total - rn_cancel) if it is after today then it should make (rn_total + rn_cancel), like this:

= if ((criation_data)<today; rn_total - rn_cancel ; rn_total + rn_cancel))

Can someone help please

Thanks

5 REPLIES 5
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Tiago_Varela ,

 

What about this formula?

 

measure =
IF ( [criation_data] < TODAY (), rn_total - rn_cancel, rn_total + rn_cancel )

If you still need help, could you share some data sample so that I could uderstand your scenario better and have test.

 

Best  Regards,

Cherry

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

Hi,

Thanks for your reply.

However when i do the IF formula it doesn't allow me to enter the criation date.

Do you have any sugestions?

 

Thanks

Hi @Tiago_Varela ,

 

What's type of criation date? Column or measure?

 

If criation date is a column, you should try this.

 

measure =
IF (Max('Table_Name' [criation_data]) < TODAY (), rn_total - rn_cancel, rn_total + rn_cancel )

If you still need help, please share some screenshots to describe your scenario in more details.

 

Best  Regards,

Cherry

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

I have a table with the criation date and another with stay dates

Then i have a table with data and measures.

 

I want to say is: for June 2019 i need to know how many rooms i had sell last year for June 2018 at the same criation date last year.

 

So Stay date: june 2019

criation date until today

it gives me the reult for 2019

 

Then i need

stay date last year without changing the dates on my factsheet (so i have "sameperiodlastyea(stay_date)

criation date last year  (sameperiodlastyear(criation_date)

then the formula must have if it is previous to today last year (26/02/2018) it gives me rn_total ; if it is after today last year it gives me rn_total+rn_cancel

 

Sorry i cannot add any screen shot or anything i don't know how i can show you.

 

Thanks a lot for your help

Hi @Tiago_Varela ,

 

You could copy you data sample which could reproduce your scenario with table format and paste here.

 

You also could share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive and post the link here. Do mask sensitive data before uploading.)

 

For image, you should see the Photos button when you reply the post.

 

Capture.PNG

 

Best Regards,

Cherry

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.