cancel
Showing results for
Did you mean:
Helper I

## DAX Function to Falculate Different Times

Dear, good afternoon!

Please could you help me I have two formulas in dax, one to calculate data until 30/09/2022 and another current formula to calculate from 01/10/2022.

I'm in need of a variable function that, when created, can apply these applications as I filter the data segmentation.

Example of the forms I have:

40_Difereca_Horas_=

"This calculation from 01/10/2022 onwards"

"This calculates until 30/09/2022

var previous_function =
CALCULATE([24_Difference_Hours_Security])

Att.

Robson

1 ACCEPTED SOLUTION
Community Support

I created some data:

Here are the steps you can follow：

1. Create calculated column.

``````Group =
var _date1=DATE(2022,1,10)
var _date2=DATE(2022,9,30)
return
SWITCH(
TRUE(),
'Table'[Date] >=_date1&&'Table'[Date]<_date2,1,
'Table'[Date]>=_date2,2
,3)``````

2. Create measure.

``````Measure =
SUMX(FILTER(ALL('Table'),'Table'[Group]=MAX('Table'[Group])),[Amount])``````

3. Result:

Best Regards,

Liu Yang

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

Community Support

I created some data:

Here are the steps you can follow：

1. Create calculated column.

``````Group =
var _date1=DATE(2022,1,10)
var _date2=DATE(2022,9,30)
return
SWITCH(
TRUE(),
'Table'[Date] >=_date1&&'Table'[Date]<_date2,1,
'Table'[Date]>=_date2,2
,3)``````

2. Create measure.

``````Measure =
SUMX(FILTER(ALL('Table'),'Table'[Group]=MAX('Table'[Group])),[Amount])``````

3. Result:

Best Regards,

Liu Yang

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

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors