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
olijo
Frequent Visitor

Half year from quarter - Q2 for first and O4 for second half

I need the new column for half year from quarterly data: for first half Q2 and for second half Q4, something like:

half yearquartervaluenew column
2004.12004.112
2004.12004.222
2004.22004.334
2004.22004.444
2005.12005.156
2005.12005.266
2005.22005.378
2005.22005.488
2006.12006.1910
2006.12006.21010
2006.22006.31112
2006.22006.41212

 

Can you help me with formula for calculated column - new column in this table?

1 ACCEPTED SOLUTION

Hi @olijo 

I'm not sure I correctly understand your question or not.

I think you want to have a column to show the Q2 value of each year for all Q1 and Q2 items of that year, and Q4 for the Q3 and Q4 items of that year.

If I'm correct, first you need to add one column to merge year, half, and quarter numbers to one value (like parent-child hierarchy):

parent-child = 
VAR _Year =
    LEFT ( 'Table'[half year ], 4 )
RETURN
    VAR _Half =
        RIGHT ( 'Table'[half year ], 1 )
    RETURN
        VAR _Quarter =
            RIGHT ( 'Table'[ quarter ], 1 )
        RETURN
            _Year & "." & _Half & "." & _Quarter

The output will be like this:

 

VahidDM_0-1628597971924.png

 

Then you can use the Parent-Child column to add a new Column with the required values:

New Column=
VAR _Year =
    LEFT ( 'Table'[half year ], 4 )
RETURN
    VAR _Half =
        RIGHT ( 'Table'[half year ], 1 )
    RETURN
        VAR _Quarter =
            RIGHT ( 'Table'[ quarter ], 1 )
        RETURN
            VAR _EvenQ =
                _Year & "." & _Half & "."
                    & EVEN ( _Quarter )
            RETURN
                LOOKUPVALUE ( 'Table'[value ], 'Table'[parent-child], _EvenQ )

 

Output:

VahidDM_1-1628598073081.png

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_2-1628598137638.png !!

View solution in original post

2 REPLIES 2
olijo
Frequent Visitor

Better version of table, so I need formula for last column:

half year           quarter          value           new column
2004.1              2004.1             1                      2
2004.1              2004.2             2                      2
2004.2              2004.3              3                     4
2004.2              2004.4              4                     4
2005.1              2005.1              5                     6
2005.1              2005.2              6                     6
2005.2             2005.3               7                     8
2005.2             2005.4               8                     8
2006.1             2006.1               9                     10
2006.1             2006.2              10                    10
2006.2             2006.3             11                    12
2006.2             2006.4             12                    12

Hi @olijo 

I'm not sure I correctly understand your question or not.

I think you want to have a column to show the Q2 value of each year for all Q1 and Q2 items of that year, and Q4 for the Q3 and Q4 items of that year.

If I'm correct, first you need to add one column to merge year, half, and quarter numbers to one value (like parent-child hierarchy):

parent-child = 
VAR _Year =
    LEFT ( 'Table'[half year ], 4 )
RETURN
    VAR _Half =
        RIGHT ( 'Table'[half year ], 1 )
    RETURN
        VAR _Quarter =
            RIGHT ( 'Table'[ quarter ], 1 )
        RETURN
            _Year & "." & _Half & "." & _Quarter

The output will be like this:

 

VahidDM_0-1628597971924.png

 

Then you can use the Parent-Child column to add a new Column with the required values:

New Column=
VAR _Year =
    LEFT ( 'Table'[half year ], 4 )
RETURN
    VAR _Half =
        RIGHT ( 'Table'[half year ], 1 )
    RETURN
        VAR _Quarter =
            RIGHT ( 'Table'[ quarter ], 1 )
        RETURN
            VAR _EvenQ =
                _Year & "." & _Half & "."
                    & EVEN ( _Quarter )
            RETURN
                LOOKUPVALUE ( 'Table'[value ], 'Table'[parent-child], _EvenQ )

 

Output:

VahidDM_1-1628598073081.png

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_2-1628598137638.png !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.