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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
EmilijaN
Helper I
Helper I

Put value only in first row that match the rules

Hello, 

 

I need help. I have two tables , the first is lookup table (google sheet) and second is the main table. I want to create a new column in main table with information of first table. There are two rules WeekStartingDate(first table)=WeekStartingDate(main table) and Dispatcher(first table)=Dispatcher(main table)  that need to be met and AdjRevenue(value) which I need to bring in the new column .But the value(AdjRevenue) I need to be put only in first row when the rules match. Like in the picture I need to have -1000 only ones, in the first row that matchs the r

EmilijaN_0-1624373545355.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@EmilijaN , Add an index column in the main table where you want add this column

add in you column

var _1 = minx(filter(maintable, [WeekStartingDate] =earlier([WeekStartingDate]) && [Dispatcher] = earlier([Dispatcher]), [Index])

var _2  =<your formula>

return

if([Index] =_1, _2, blank())

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
EmilijaN
Helper I
Helper I

@amitchandak 
Thank you so much!!!

amitchandak
Super User
Super User

@EmilijaN , Add an index column in the main table where you want add this column

add in you column

var _1 = minx(filter(maintable, [WeekStartingDate] =earlier([WeekStartingDate]) && [Dispatcher] = earlier([Dispatcher]), [Index])

var _2  =<your formula>

return

if([Index] =_1, _2, blank())

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

Do you mean like this?

VAR _1 = minx(filter(Trip_Activity, Trip_Activity[SH_DelDate] =earlier(Trip_Activity[SH_DelDate]) && Trip_Activity[Dispatcher] = earlier(Trip_Activity[Dispatcher]), Trip_Activity[Index]))
VAR _2 =CALCULATE (
    SELECTEDVALUE ( Comm_Base_Link_Adj_Dispatch[Adj_Comm_GrossBase]),
    FILTER (
     Comm_Base_Link_Adj_Dispatch,(Comm_Base_Link_Adj_Dispatch[WeekStartingDate]=Trip_Activity[SH_DelDate] && Comm_Base_Link_Adj_Dispatch[Dispatcher]=Trip_Activity[Dispatcher])
))

return

if([Index] =_1, _2, blank())

 

 

I tried. There is some error :The syntax for 'var_pom2' is incorrect.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors