Forum Discussion

ANILKORLIMARLA's avatar
ANILKORLIMARLA
Frequent Visitor
3 years ago
Solved

apply row number in table visual

i want to add row number to this table , The row number need to change as per the filter selection. i donot have any measure in this table 

 

  • Jihwan_Kim's avatar
    Jihwan_Kim
    3 years ago

     

    Hi,

    Thank you for your feedback.

    I fixed the measure like below.

    Please check the attached file as well.

    Thank you.

     

    Row number measure: = 
    VAR _newtable =
        ADDCOLUMNS (
            ALLSELECTED( Data ),
            "@Rankcategory",
                CALCULATE (
                    RANKX ( ALLSELECTED( Data ), CALCULATE ( MAX ( Data[Category] ) ),, asc, DENSE )
                ),
            "@Ranksubcategory",
                CALCULATE (
                    RANKX ( ALLSELECTED( Data ), CALCULATE ( MAX ( Data[Sub-Category] ) ),, asc, DENSE )
                )
        )
    VAR _newranking =
        ADDCOLUMNS (
            _newtable,
            "@newranking",
                RANKX ( _newtable, [@Rankcategory] * 100 + [@Ranksubcategory],, asc )
        )
    RETURN
        MAXX (
            FILTER (
                _newranking,
                Data[Category] = MAX ( Data[Category] )
                    && Data[Sub-Category] = MAX ( Data[Sub-Category] )
            ),
            [@newranking]
        )
    

     

3 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

    Row number measure: =
    VAR _newtable =
        ADDCOLUMNS (
            ALL ( Data ),
            "@Rankcategory",
                CALCULATE (
                    RANKX ( ALL ( Data ), CALCULATE ( MAX ( Data[Category] ) ),, asc, DENSE )
                ),
            "@Ranksubcategory",
                CALCULATE (
                    RANKX ( ALL ( Data ), CALCULATE ( MAX ( Data[Sub-Category] ) ),, asc, DENSE )
                )
        )
    VAR _newranking =
        ADDCOLUMNS (
            _newtable,
            "@newranking",
                RANKX ( _newtable, [@Rankcategory] * 100 + [@Ranksubcategory],, asc )
        )
    RETURN
        MAXX (
            FILTER (
                _newranking,
                Data[Category] = MAX ( Data[Category] )
                    && Data[Sub-Category] = MAX ( Data[Sub-Category] )
            ),
            [@newranking]
        )
    

     

    • ANILKORLIMARLA's avatar
      ANILKORLIMARLA
      Frequent Visitor

      thanks Kim for the quick response, when i apply category filter and select technology the row number is not updating dynamically.

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

         

        Hi,

        Thank you for your feedback.

        I fixed the measure like below.

        Please check the attached file as well.

        Thank you.

         

        Row number measure: = 
        VAR _newtable =
            ADDCOLUMNS (
                ALLSELECTED( Data ),
                "@Rankcategory",
                    CALCULATE (
                        RANKX ( ALLSELECTED( Data ), CALCULATE ( MAX ( Data[Category] ) ),, asc, DENSE )
                    ),
                "@Ranksubcategory",
                    CALCULATE (
                        RANKX ( ALLSELECTED( Data ), CALCULATE ( MAX ( Data[Sub-Category] ) ),, asc, DENSE )
                    )
            )
        VAR _newranking =
            ADDCOLUMNS (
                _newtable,
                "@newranking",
                    RANKX ( _newtable, [@Rankcategory] * 100 + [@Ranksubcategory],, asc )
            )
        RETURN
            MAXX (
                FILTER (
                    _newranking,
                    Data[Category] = MAX ( Data[Category] )
                        && Data[Sub-Category] = MAX ( Data[Sub-Category] )
                ),
                [@newranking]
            )