cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Helper II

## Calculate formula by term

Dear, good afternoon!

I need some help with the DAX formula.

I have a formula that already calculates correctly every month, but I need this formula to be divided in two ways, being:

The current formula calculates until 09/2022 and the new one I created ignore the previous one and start considering from 10/2022 onwards the new formula for the next few months.

Just adding the need. I thought of a formula with the "IF", Example: IF d'calenadario is smaller 30/09/2022 will use formula A, otherwise it will use formula B. Something like that.

Could someone help me assemble this formula?

Att.

Robson

1 ACCEPTED SOLUTION
Community Support

Use selectedvalue() to wrap the date column.

Measure C = IF(selectedvalue(calendar[date])<=date(2022,9,30),[Measure A],[Measure B])

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
3 REPLIES 3
Community Support

Use selectedvalue() to wrap the date column.

Measure C = IF(selectedvalue(calendar[date])<=date(2022,9,30),[Measure A],[Measure B])

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

Measure C = IF(calendar[date]<=date(2022,9,30),[Measure A],[Measure B])

IF I misunderstood your meaning, please share some sample data and expected result.

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Helper II

Good evening!

Thanks for the feedback.

The function you sent I just didn't understand this calendar[date] field, because when I put IF it doesn't call dcalendario.

I'll put more details, being:

I have two formulas in dax, one to calculate data up to 09/30/2022 and another current formula to calculate from 10/01/2022.

I need a function that when created can apply these two variables

Example of the forms I have:

40_Difereca_Horas_=

"This calculation from 01/10/2022 onwards"

"This calculates to 30/09/2022

var previous_function =
CALCULATE([24_Difference_Hours_Security])

Att.

Robson

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors