cancel
Showing results for 
Search instead for 
Did you mean: 

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

Reply
Mohsin2022
Helper I
Helper I

SUM RESULT SHOULD BE SHOWN AGAINST ONE ROW

Mohsin2022_0-1656714587803.png

 

I WANT TO SUM DATA BASED ON PROD ID BUT SUM VALUE SHOULD BE SHOWN ON SINGLE ROW 

 

NOW ALL THE LINE HAVE SAME VALUE 

2 ACCEPTED SOLUTIONS

@Mohsin2022 
You need first to add an index column using power query.

1.png

Then creat a new calculated column using dax

2.png

Result = 
VAR CurrentIDTable = CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[ProdID] ) )
VAR CurrentIndex = Data[Index]
VAR FirstIndex = MINX ( CurrentIDTable, Data[Index] )
RETURN
    IF ( CurrentIndex = FirstIndex, Data[Current] )

View solution in original post

@Mohsin2022 
Please use

BOMID New =
CALCULATE ( MAX ( Data[BOMID] ), ALLEXCEPT ( Data, Data[ProdID] ) )

View solution in original post

23 REPLIES 23
Mohsin2022
Helper I
Helper I

for Example

 

Untitled.png

Hi @Mohsin2022 
Please connect both tables via ItemID (It would be many to many 2way). Then create the column in Table1

 

Last Price Look up =
MAXX (
    FILTER ( RELATEDTABLE ( Table2 ), Table2[Last Price] <> BLANK () ),
    Table2[Last Price]
)

Also this one should simply work

Last Price Look up =
MAXX (
    RELATEDTABLE ( Table2 ),
    Table2[Last Price]
)

 

Thanks dear its working

Now if i want to add average price column in table 2 like i did for last price

Then i will look up average price as well 

Yes

How can i average price based on year criteria 

AVERAGEX ( RELATEDTABLE, Price )

Brother its not working getting one value in all feilds

 

i have attached one picture below i want to do same think Untitled 1.png

@tamerj1  please help 

Mohsin2022
Helper I
Helper I

@tamerj1  thanks for your support 

one more thing 

i have two table i need to look up price from one table for items both table have multiple items for each items but as per your last trick i have used index column and created same formula for last price now i have last price column where only last prices are shown rest lines are empty now i need to lookup from that last price into other column when i used lookup it shows error of multiple entries supplied

 

please help

@Mohsin2022 
What was the formula that you've used?

i used look up and first non blank with filter

Mohsin2022
Helper I
Helper I

I have one more issue

 

Mohsin2022_0-1656920944350.png

 

in my data some of BOMID column has no value i want to make one criteria that if BOMID is blank then give me same BOMID of that PRODID

@Mohsin2022 
Please use

BOMID New =
CALCULATE ( MAX ( Data[BOMID] ), ALLEXCEPT ( Data, Data[ProdID] ) )
Mohsin2022
Helper I
Helper I

ProdIDCurrentRequired

RAK-001

250

250

RAK-001

250 

RAK-002

300300

RAK-002

300 

 

for better undertsanding i have created sample table 

Mohsin2022
Helper I
Helper I

@tamerj1 when there is change in PRODID column on the very first record sum value should be displayed rather than on all line with same value 

i have data of around 100k rows

Mohsin2022
Helper I
Helper I

@tamerj1  in the right last column i just need only one value now each row has same values

@Mohsin2022 
Ok that is clear but how did you calculate that column? In Power Query? Or this is part of the source data?

@tamerj1  its part of source data from sql query

@Mohsin2022 
You need first to add an index column using power query.

1.png

Then creat a new calculated column using dax

2.png

Result = 
VAR CurrentIDTable = CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[ProdID] ) )
VAR CurrentIndex = Data[Index]
VAR FirstIndex = MINX ( CurrentIDTable, Data[Index] )
RETURN
    IF ( CurrentIndex = FirstIndex, Data[Current] )

@tamerj1  THANKS DEAR ITS WORKING 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Power BI Fabric Summit Carousel

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