Forum Discussion
Create a measure Based on Visual values
- 1 year ago
Hi chetan8080,
I have used sample data and implemented the solution in Power BI Desktop. Please have a look."Try this DAX Measure:
Unique In Visual =VAR CurrentValue = SELECTEDVALUE(Sheet1[Value])VAR VisibleRows =SUMMARIZE(ALLSELECTED(Sheet1),Sheet1[ID],Sheet1[Value])VAR CountVisible =COUNTROWS(FILTER(VisibleRows,[Value] = CurrentValue))RETURN IF(CountVisible = 1, 1, 0)I have included the PBIX file that I created using the provided sample data. Kindly review it and confirm whether it aligns with your expectations.I hope my suggestions provided valuable insights. If you have any further questions, don’t hesitate to ask in a follow-up message.
If this post helped, please mark it as "Accept as Solution" so others can benefit as well.Best regards,
Sahasra
Communtiy Support Team. - 1 year ago
Hi chetan8080,
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you providedNeed help uploading data?How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Thank you.
To achieve a measure that evaluates uniqueness *based on what's displayed in the matrix visual* (ignoring backend duplicates), you can use the DAX function ISINSCOPE along with COUNTROWS and FILTER on visible data using ALLSELECTED.
Here’s a measure that does this:
Unique In Visual =
VAR CurrentValue = SELECTEDVALUE('YourTable'[ID])
VAR CountVisible =
CALCULATE(
COUNTROWS('YourTable'),
FILTER(
ALLSELECTED('YourTable'),
'YourTable'[ID] = CurrentValue
)
)
RETURN IF(CountVisible = 1, 1, 0)🧩 How it works:
- SELECTEDVALUE: Gets the current row value in the matrix.
- ALLSELECTED: Limits calculation to only what's visible in the matrix (not the whole table).
- FILTER + COUNTROWS: Counts how many times that value appears in the visual.
- IF = 1: Means the value appears only once = unique in visual.
📌 Usage Tip:
Add this measure to your matrix visual along with the ID and check the output. The measure will return 1 for unique IDs in the visual and 0 for repeated ones.
📚 Reference:
✔️ If my message helped solve your issue, please mark it as Resolved! 👍 If it was helpful, consider giving it a Kudos! |