cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Combining two columns after the latest value

Hello,

I have two columns and I want to combine these two columns after the latest value. Could you please help me?

Example:

 Date Column A Column B Combined Column A and B 2022-01-01 100 null null 2022-01-02 150 null null 2022-01-03 150 null null 2022-01-04 250 750 750 2022-01-05 200 200 2022-01-06 50 50
1 ACCEPTED SOLUTION
Continued Contributor

This calculates the max date of column B and then uses it till it gets to the date and then to A. Snippet and sample file is also attached.

``````A+B =
VAR MaxDateB =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[B] ) ) )
)
RETURN
IF ( 'Table'[Date] <= MaxDateB, 'Table'[B], 'Table'[A] )
``````

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.
4 REPLIES 4
Frequent Visitor

Thank you it worked!

Frequent Visitor

I meant till to the last value on column B, it should get the values from column B which 750 in the example, then column A.

Continued Contributor

This calculates the max date of column B and then uses it till it gets to the date and then to A. Snippet and sample file is also attached.

``````A+B =
VAR MaxDateB =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[B] ) ) )
)
RETURN
IF ( 'Table'[Date] <= MaxDateB, 'Table'[B], 'Table'[A] )
``````

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.
Continued Contributor

Hi @jacko11

It isn't clear what you mean by combine the two column after the latest value? From the snippet example it seems like you are taking Column B as a priority and then when there is nothing in column B then you take column A, is this correct?

If that is the case you would simple do something like

``Combined Column A and B = If(NOT(ISBLANK(Column B)),Column B, Column A)``

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors