Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
HM615
Helper I
Helper I

Filter table visual to show single row per value, according to other values in the source table.

In my source data, there are multiple rows per ID number. I have a simple table visual showing certain values that correspond to that ID number. I want to filter that visual so each ID number only appears once, according to specific criteria. I am pasting dummy sample data below to make this clearer. What I am looking for is the column B value for each ID in column A - however, I only want one single B value for each ID in column A, although my source data has multiple rows with multiple values. If column C is UF, that is the value I want. If there is no UF for a particular ID, then I want the max value that is in B. I have no idea how to do it! 

 

HM615_0-1725376595430.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_0-1725423363307.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: =
VAR _partitionuf =
    FILTER (
        WINDOW (
            1,
            ABS,
            -1,
            ABS,
            ALL ( data ),
            ORDERBY ( data[value], DESC ),
            ,
            PARTITIONBY ( data[id] ),
            MATCHBY ( data[id], data[value], data[condition] )
        ),
        data[condition] = "uf"
    )
VAR _partitionall =
    WINDOW (
        1,
        ABS,
        1,
        ABS,
        ALL ( data ),
        ORDERBY ( data[value], DESC ),
        ,
        PARTITIONBY ( data[id] ),
        MATCHBY ( data[id], data[value], data[condition] )
    )
RETURN
    IF (
        COUNTROWS ( _partitionuf ) >= 1,
        MAXX ( _partitionuf, data[value] ),
        MAXX ( _partitionall, data[value] )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_0-1725423363307.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: =
VAR _partitionuf =
    FILTER (
        WINDOW (
            1,
            ABS,
            -1,
            ABS,
            ALL ( data ),
            ORDERBY ( data[value], DESC ),
            ,
            PARTITIONBY ( data[id] ),
            MATCHBY ( data[id], data[value], data[condition] )
        ),
        data[condition] = "uf"
    )
VAR _partitionall =
    WINDOW (
        1,
        ABS,
        1,
        ABS,
        ALL ( data ),
        ORDERBY ( data[value], DESC ),
        ,
        PARTITIONBY ( data[id] ),
        MATCHBY ( data[id], data[value], data[condition] )
    )
RETURN
    IF (
        COUNTROWS ( _partitionuf ) >= 1,
        MAXX ( _partitionuf, data[value] ),
        MAXX ( _partitionall, data[value] )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
BabyYoda
Frequent Visitor

Try this if you need a measure: 

Cleaned Column B Measure = Var ColA = SELECTEDVALUE(SampleTable[Column A])
Var HasUF = MAXX(FILTER(SampleTable, SampleTable[Column A]=ColA&&SampleTable[Column C]="UF"), SampleTable[Column B])
Var NoUF = MAXX(FILTER(SampleTable, SampleTable[Column A]=ColA), SampleTable[Column B])
 RETURN SWITCH(TRUE(), ISBLANK(HasUF), NoUF, HasUF)
 
or if you need a calculated column try this
Cleaned Column B = Var ColA = SampleTable[Column A]
Var HasUF = MAXX(FILTER(SampleTable, SampleTable[Column A]=ColA&&SampleTable[Column C]="UF"), SampleTable[Column B])
Var NoUF = MAXX(FILTER(SampleTable, SampleTable[Column A]=ColA), SampleTable[Column B])
 RETURN SWITCH(TRUE(), ISBLANK(HasUF), NoUF, HasUF)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors