Forum Discussion

sabeensp's avatar
sabeensp
Helper IV
7 years ago
Solved

Remove Duplicates in GRID

Hello,

I have a very simple visual questions. I'm using Grid to show data. WHich has over 20 columns, but I only need to insert a break on first column and do not want to repeat the value.

 

 

  • MariaP's avatar
    MariaP
    7 years ago

    Hi sabeensp ,

     

    Potential workaround is shown here if you are able to use the Table visual.

    See last table for final result requested

    You need to add an index to your table and then add a column  with this code:

    Previous Value = 
       
        var thisColumn1 =  'DataColumns'[column1]
    
        var thisIndex= 'DataColumns'[Index]
    
        var thisPrevIndex = CALCULATE(
    
                            MAX('DataColumns'[Index])
    
                            ,FILTER(ALL('DataColumns')
    
                                ,'DataColumns'[column1] = thisColumn1 && 'DataColumns'[Index] < thisIndex
    
                            )
    
        )
    
        var thePreviousValue = CALCULATE(
    
                                    MAX('DataColumns'[column1])
    
                                    ,FILTER(ALL('DataColumns')
    
                                        ,'DataColumns'[column1] = thisColumn1 && 'DataColumns'[Index] = thisPrevIndex
    
                                    )
    
        )
     VAR  displayValue =   
                                IF ( 'DataColumns'[Index] <>  0   && thePreviousValue = thisColumn1   , BLANK(), thisColumn1 ) 
    
       return
    
          displayValue
    
    
    
     

    Then create a measure to use the conditional fomatting for the column:

    colorKPI = SWITCH( TRUE()
     , MAX (DataColumns[column1] ) = MAX (DataColumns[Previous Value]), "#000000", "#FFFFFF")

    Finally , use both field fomratting and conditional formatting to format the colours accordingly.

    I have uploaded the file also for you to see.

    Note , when you sort by the other columns the order fo Column1 obiviously changes  and this may not be an acceptable solution for you, however it is a potential workaround.

     

    SAMPLE ON DROPBOX

     

    Thanks, 
    Maria

     

     

     

  • Hi sabeensp ,

    You could submit your idea in Power BI ideas Froum and add your comments there to improve Power BI and make this feature coming sooner.

    Additional workaround for your requirement, you may could try Matrix in Power BI like below.

    You could drag column1 and column2 in Row field and turn off the stepped layout of the Row headers. 

    Hope this can help you!

    Best  Regards,

    Cherry

     

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    What comes immediatley to mind is removing duplicates in the query editor under 'Remove Rows'. 

    • sabeensp's avatar
      sabeensp
      Helper IV

      AnonymousThat would affect all the report, I just need to remove from this visual. Is there a way?




       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Is the visual you shared what you want your end product to look like or is that what is currently being displayed? I am uncertain what exactly your end product should look like.