Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I would like to create a visual based on the below data which should show the average Param value of the three Item_IDs (with have the highest SortKey) of an Item . The Item shall be selected with a page slicer.
I added the two below measures:
ReleaseRank =
RANKX(ALLSELECTED('item_values'), CALCULATE(SUM('item_values'[SortKey])), ,DESC, Dense)
Average_Of_The_Three_Latest_ItemIDs_of_An_Item =
VAR latest = CALCULATE(MAX('Item_values'[Param]), FILTER(ALLSELECTED('Item_values'), 'Item_values'[ReleaseRank] = 1))
VAR secondlatest = CALCULATE(MAX('Item_values'[Param]), FILTER(ALLSELECTED('Item_values'), 'Item_values'[ReleaseRank] = 2))
VAR thirdlatest = CALCULATE(MAX('Item_values'[Param]), FILTER(ALLSELECTED('Item_values'), 'Item_values'[ReleaseRank] = 3))
return IF(AND(NOT(ISBLANK(secondlatest)), NOT(ISBLANK(thirdlatest))),
(latest + secondlatest + thirdlatest) / 3,
IF(AND(NOT(ISBLANK(secondlatest)), ISBLANK(thirdlatest)),
(latest + secondlatest) / 2,
latest))
The visual does provide the average value of the selected Item in the slicer, however it also includes all other Items which are present in the 'item_values' Table. I have tried different alternatives in the Calculate-filter for only showing the selected Item's average without any luck.
I believe that the above measure formulas and logic could also be written in a better way.
Thanks for your support.
Regards,
Akis
'item_values' Table
Item_ID | Item | Param | SortKey |
ItemA 1.4 | ItemA | 0 | 1040000 |
ItemA 1.3 | ItemA | 1 | 1030000 |
ItemA 1.2 | ItemA | 2 | 1020000 |
ItemA 1.1 | ItemA | 3 | 1010000 |
ItemA 1.0 | ItemA | 5 | 1000000 |
ItemB 1.3 | ItemB | 20 | 1030000 |
ItemB 1.2 | ItemB | 2 | 1020000 |
ItemB 1.1 | ItemB | 3 | 1010000 |
ItemB 1.0 | ItemB | 16 | 1000000 |
Solved! Go to Solution.
Hi @lafakios try this
If this response was helpful, please accept it as a solution and give kudos to support other community members.
Hi @lafakios try this
If this response was helpful, please accept it as a solution and give kudos to support other community members.
Thank you very much for the support provided!
The two provided formulas did deliver the wanted results.
Regards,
Akis
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
78 | |
58 | |
35 | |
32 |
User | Count |
---|---|
99 | |
59 | |
56 | |
46 | |
40 |