Forum Discussion

chetan8080's avatar
chetan8080
Helper II
1 year ago
Solved

Create a measure Based on Visual values

I need to create a measure where it gives me 1 or 0 based on values in a matrix visual, In the above picture the first two yellow highlighted values are unique in the matrix should have 1 as r...
  • v-sgandrathi's avatar
    v-sgandrathi
    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.