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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Kavya_Mahesh
Regular Visitor

Power BI DAX syntax to calculate value from two different column for different time frame

Hi,

I have three type of value Low, Average and High calculated in three different column for a 1000+ entries in excel for timeframe starting from 1970 to 2030.

What would be the DAX syntax to create new column and get high value for year 1970 to 2026 and Avergae value for year 2027 to 2030.

Appreciate help on this.

1 ACCEPTED SOLUTION
FarhanJeelani
Super User
Super User

Hi @Kavya_Mahesh ,

 

Try this

NewColumn =
IF(
'YourTable'[Year] >= 1970 && 'YourTable'[Year] <= 2026,
'YourTable'[High],
IF(
'YourTable'[Year] >= 2027 && 'YourTable'[Year] <= 2030,
'YourTable'[Average],
BLANK()
)
)

View solution in original post

5 REPLIES 5
govind_021
Super User
Super User

Hey Try this approach , 
New Value =
IF(
YEAR(YourTable[DateColumn]) <= 2026,
YourTable[High],
IF(YEAR(YourTable[DateColumn]) >= 2027 && YEAR(YourTable[DateColumn]) <= 2030,
YourTable[Average],
BLANK() -- This will return blank for other years outside 1970-2030
)
)

Anonymous
Not applicable

Hi @Kavya_Mahesh

Thanks for the reply from FarhanJeelani.

 

Could you please share a bit more about your excel table like sample data?

 

Do you want to create a calculated column assigning different value based on year addressed?

 

If so, I have made a test for your reference.

 

Here is my sample data:

vqiaqimsftv_0-1736834165605.png

 

You could directly create a calculated column and write the DAX as below:

 

NewColumnTest = 
VAR _YearValue = YEAR('Table'[Date])  -- Extract the year from DateValue
RETURN
    IF(
        _YearValue <= 2026, 
        'Table'[High], 
        IF(
            _YearValue >= 2027 && _YearValue <= 2030, 
            'Table'[Average], 
            BLANK()
        )
    )

 

 

Here is the testing result:

vqiaqimsftv_1-1736834219733.png

I would be grateful if you could provide me with the pbix file or sample data.

 

The pbix file is attached.

 

If you have any other question please feel free to contact me.

 

Best Regards,
Qi
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!

Hi,

Thank you so much for the solution.

 

The sample you have created is exactly what I was looking for, except I directly have year column, so I guess I can skip the extract function.

 

Regards

Mahesh 

FarhanJeelani
Super User
Super User

Hi @Kavya_Mahesh ,

 

Try this

NewColumn =
IF(
'YourTable'[Year] >= 1970 && 'YourTable'[Year] <= 2026,
'YourTable'[High],
IF(
'YourTable'[Year] >= 2027 && 'YourTable'[Year] <= 2030,
'YourTable'[Average],
BLANK()
)
)

Hi,

Thank you so much.

This worked perfectly.

Regards

Mahesh 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.