Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Dax-Measure return column/data if count ...

Hello fellow PowerBi users,

 

right now i have a column in a table, which i dragged into a "card". So depending on (clicking on a custom diagram) it filters out all the unneeded rows and just shows data from some rows.

But if i dont click anything/dont have any filter applied i want to show nothing instead of the first value of the column. So i wanted to use a measure, but i am not sure how to create it exactly. I thought of something like this:

----------------------------------

Measure=

VAR _count = COUNTROWS(Table)

Return

if( _count>10, " ", Table(Description) )

-----------------------------------

(or maybe MAX or Concatentate before Table(Description) before it so it isnt a "naked" column reference) but it doesnt work eighter. 

 

So my question is: How do i show all aggregated data of one filtered column in one cell together in a card, but if its unfiltered and has more then a certain amount of rows (10) it doesnt show anything?

 

(but if sombody has an idea what i did wrong at my basic attempt without the aggregation i would be thankful as well)

 

Thank you a lot:)

Strathos

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create a measure as below:

    Measure = 
    VAR _count =
        COUNTROWS ( ALLSELECTED ( 'Table' ) )
    VAR _combinedtext =
        CONCATENATEX ( VALUES ( 'Table'[Description] ), 'Table'[Description], "," )
    RETURN
        IF ( NOT ( ISFILTERED ( 'Table'[Item] ) ) || _count > 10, BLANK (), _combinedtext )

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      thx, didn't know that, but sadly it doesn't work as the visual doesn't apply a real filter that PowerBi can detect, it just temporarily removes the rows somehow.

      So i still have to do it with the COUNTROWS function somehow.

      • PC2790's avatar
        PC2790
        Community Champion

        If you want to show blank if row count increases 10, you cna try this:

        Noofrows = 
        var _count = CALCULATE(CountRows(ALLSELECTED(Table)))
        return
        if(_count>10,BLANK(),_count)