Forum Discussion
need help with a measure
Hi all,
i am trying to build a dashboard with a item bidding streaming dataset. The dataset are similar to the following:
| item | bid | name | timestamp |
| watch | 10 | john | 7/4/2019 0:00 |
| ipad | 300 | ian | 7/4/2019 18:00 |
| ipad | 300 | peter | 7/4/2019 19:00 |
| ipad | 240 | john | 7/4/2019 19:00 |
I am trying to build a table to display highest bid by name and item like the following:
| Item | Highest bid | name |
| ipad | 300 | ian |
| watch | 10 | john |
I created a measure to get highest bid per item with
HighestBidPeritem =
MAXX(
KEEPFILTERS(VALUES('RealTimeData'[item])),
CALCULATE(MAX('RealTimeData'[bid]))
)I created a measure to get the name with highest bidHighestBidPerItem_employee = CALCULATE (
SELECTEDVALUE ( RealTimeData[employee], "*** multiple bids ***" ),
FILTER ( ALL ( RealTimeData[bid]), RealTimeData[bid] = MAX (RealTimeData[bid]) )
)HighestBidPerRoom_employee = CALCULATE (
SELECTEDVALUE( RealTimeData[employee] ),
FILTER ( RealTimeData, RealTimeData[bid] = max(RealTimeData[bid]) ),
FILTER ( RealTimeData, RealTimeData[timestamp] = min(RealTimeData[timestamp]) )
)
2 Replies
- MFelix
Super User
Hi ivan15 ,
I created a model using your first and third measure and the final result is below:
So I don't see any issue with your measure only thing I would change is how you make your filter function:
HighestBidPerRoom_employee = CALCULATE ( SELECTEDVALUE ( RealTimeData[name] ); FILTER ( ALLSELECTED ( RealTimeData[bid]; RealTimeData[timestamp] ); RealTimeData[bid] = MAX ( RealTimeData[bid] ) && RealTimeData[timestamp] = MIN ( RealTimeData[timestamp] ) ) )Using the ALLSELECTED function and having only the columns that you want to filter will increase performance. When I first started working with DAX a great guru (Alberto Ferrari) replied to a post I was answering and referred that if you use a filter function on a full table if you have a lot of data your performance will suffer because of the interactions that will cover all rows in the table, selecting only the columns you need the number of interactions decrease.
What is the version you are using of PBI?
Regards,
MFelix
- v-lili6-msft
Community Support
hi, ivan15
I have test your formula on my side, it works well.
And I think if there are [name] with the same max([bid]) and min(RealTimeData[timestamp]) leads the problem.
Could you share your sample pbix file for us have a test?
Best Regards,
Lin