cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

Table Repeat value based on other column

Hi All,

I want to create a calculation "Baseline" like the one below that contains the 1st value from [Pop Coverage] col and its repeated though the whole [Year] Col.

1 ACCEPTED SOLUTION
Solution Supplier

Here is my solution:

1. Create a calculate column for Date in the table using the below DAX:

`Date = VAR MonthNum = SWITCH( TRUE(),'DataTable'[Month] = "January",1,'DataTable'[Month] = "February",2,'DataTable'[Month] = "March",3,'DataTable'[Month] = "April",4,'DataTable'[Month] = "May",5,'DataTable'[Month] = "June",6,'DataTable'[Month] = "July",7,'DataTable'[Month] = "August",8,'DataTable'[Month] = "September",9,'DataTable'[Month] = "October",10,'DataTable'[Month] = "November",11,'DataTable'[Month] = "December",12)VAR Result = DATE( 'DataTable'[Year], MonthNum , 1)RETURNResult`

Table Snapshot:

`2. Create a measure for Baseline:Baseline =VAR MinDate =CALCULATE (MIN ( 'DataTable'[Date] ),ALL ( 'DataTable' ),'DataTable'[Year] = SELECTEDVALUE ( 'DataTable'[Year] ))VAR Result =CALCULATE (MIN ( 'DataTable'[Pop Coverage] ),ALL ( 'DataTable' ),'DataTable'[Year] = SELECTEDVALUE ( 'DataTable'[Year] ),'DataTable'[Date] = MinDate)RETURNResult`

Output Snapshot:

Hope this helps.

 ** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you ! Good Luck 👍

3 REPLIES 3
Solution Supplier

Here is my solution:

1. Create a calculate column for Date in the table using the below DAX:

`Date = VAR MonthNum = SWITCH( TRUE(),'DataTable'[Month] = "January",1,'DataTable'[Month] = "February",2,'DataTable'[Month] = "March",3,'DataTable'[Month] = "April",4,'DataTable'[Month] = "May",5,'DataTable'[Month] = "June",6,'DataTable'[Month] = "July",7,'DataTable'[Month] = "August",8,'DataTable'[Month] = "September",9,'DataTable'[Month] = "October",10,'DataTable'[Month] = "November",11,'DataTable'[Month] = "December",12)VAR Result = DATE( 'DataTable'[Year], MonthNum , 1)RETURNResult`

Table Snapshot:

`2. Create a measure for Baseline:Baseline =VAR MinDate =CALCULATE (MIN ( 'DataTable'[Date] ),ALL ( 'DataTable' ),'DataTable'[Year] = SELECTEDVALUE ( 'DataTable'[Year] ))VAR Result =CALCULATE (MIN ( 'DataTable'[Pop Coverage] ),ALL ( 'DataTable' ),'DataTable'[Year] = SELECTEDVALUE ( 'DataTable'[Year] ),'DataTable'[Date] = MinDate)RETURNResult`

Output Snapshot:

Hope this helps.

 ** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you ! Good Luck 👍

Frequent Visitor

Thank you!!! 🙂 it works

Solution Supplier

@PatCreator You are welcome 😀👍

Announcements

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Power BI Monthly Update - February 2024

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

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors