Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! 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