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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Formula adapt to current year

Hey Guys,

 

I need help with the following formula:

Toolbox vereist 2 = CALCULATE(IF( YEAR (MAX(Datum[Datum]))= YEAR( NOW()),

10/12 * ((CALCULATE(DISTINCTCOUNT(Datum[Maand]), personen[afdeling] = "BPM" || personen[afdeling] = "Asfalt" )) *
Calculate(DISTINCTCOUNT(Personen[Naam]), personen[afdeling] = "BPM" || personen[afdeling] = "Asfalt" )) *
[Huidige dag vh jaar] / 356,
 
10/12 * ((CALCULATE(DISTINCTCOUNT(Datum[Maand]), personen[afdeling] = "BPM" || personen[afdeling] = "Asfalt" )) *
Calculate(DISTINCTCOUNT(Personen[Naam]), personen[afdeling] = "BPM" || personen[afdeling] = "Asfalt" ))),

Datum[Datum] > DATE(2020,1,1), Datum[Datum] < DATE(YEAR(TODAY())+1,1,1)
)
 
Is it possible to make the formula that if i select the current year, that it really shows me the value up untill today (or this month)?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1654148677182.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

vyangliumsft_1-1654148677185.png

2. Create measure.

Measure_today =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
    _select = YEAR(TODAY()),
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=TODAY()&&'Table'[afdeling] in {"BPM","Asfalt"})))
Measure_Month =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
    _select = YEAR(TODAY()),
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=EOMONTH(TODAY(),0)&&'Table'[afdeling] in {"BPM","Asfalt"})))

3. Result:

vyangliumsft_2-1654148677187.png

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1654148677182.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

vyangliumsft_1-1654148677185.png

2. Create measure.

Measure_today =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
    _select = YEAR(TODAY()),
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=TODAY()&&'Table'[afdeling] in {"BPM","Asfalt"})))
Measure_Month =
var _select=SELECTEDVALUE('Table 2'[Year])
return
IF(
    _select = YEAR(TODAY()),
CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Date]>=DATE(2020,1,1)&&'Table'[Date]<=EOMONTH(TODAY(),0)&&'Table'[afdeling] in {"BPM","Asfalt"})))

3. Result:

vyangliumsft_2-1654148677187.png

 

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

amitchandak
Super User
Super User

@Anonymous ,

New Measure  =

var _fil = if( year(selectedvalue(Datum[Datum])), Year(Today()) , filter(Datum, Datum[Datum] <= Today()) ,filter(Datum, Datum[Datum] = selectedvalue(Datum[Datum])) )

 

return

calculate([Measure], _fil )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.