cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Resolver II

## need help with calculated column

I have a table named A in which i have two column - date and sales - and i have another table B with three columns - start date , end date and category - where in table B I only have 4 rows for 4 categories.

So i want to add a column in table A such that if date in table A lies between Start date and end date of Table B then it returns category based on date range it lies in.

1 ACCEPTED SOLUTION
Super User

Pls try to create a column

``Column = MAXX(FILTER(TableB,TableB[Startdate]<='TableA'[date]&&TableB[Enddate]>='TableA'[date]),TableB[Category])``

pls see the attachment below.

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

Proud to be a Super User!

5 REPLIES 5
Super User

Hi,

Enter this calculated column formula in TableA

Category = calculate(max(TableB[category]),filter(TableB,TableB[Start Date]<=earlier(TableA[Date])&&TableB[End Date]>=earlier(TableA[Date])))

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Super User

Pls try to create a column

``Column = MAXX(FILTER(TableB,TableB[Startdate]<='TableA'[date]&&TableB[Enddate]>='TableA'[date]),TableB[Category])``

pls see the attachment below.

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

Proud to be a Super User!

Resolver II

Thanks @ryan_mayu, with some changes according to my requirement your solution is working fine for me.

Super User

you are welcome

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

Proud to be a Super User!

Solution Sage

Would you provide data and expected output

Announcements

#### Power BI Monthly Update - November 2023

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

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors