Forum Discussion
Rank and Partition
I have a list of items with pricing as value by delivery date. Because the direct query data has multiple duplicated entries per items, the row subtotal shows 10X more than what it should be. If I create a new measure with rank to bring most recent data shown to make the subtotal, what should it be? Thank you in advance.
This is what I thought to use rankx
Rank =
RANKX(ALL(Hub,Item),Item Cost)
11 Replies
- amitchandakSuper User
sunah132 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
You can get last price for an item like
Measure =
VAR __id = MAX ('Table'[item] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[item] = __id )
CALCULATE ( max ('Table'[price] ), VALUES ('Table'[item] ),'Table'[item] = __id,'Table'[Date] = __date )- sunah132Helper I
Thank you, I have attached a new example about this.
- AnonymousNot applicable
Hi sunah132
I took a look at the pbix file you provided, and the current rendering is as follows. What is the result you need, could you explain it? From the data you provide so far, I am not particularly clear about your needs.
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- sunah132Helper I
Hi Ailsa,
There are multiple duplicated data per item and I had to bring the minimum cost of the table per day to sum up the total. There were daily pricing and misc. pricing on every Wednesday that I had to put together into the table with minimums on it. I tried tweaking Ryan's DAX to both charges added onto it but I was struggling getting them calculated. Thank you for look into this!