Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sort a graphic

Hi guys,

 

In in this graphic, I would like to sort descending by the % of "Terminé"  but I don't have this option in the suggestion of sorting. I think about creating a measure to put it in tooltips and I could sort by this one.

 

I count the number of Controle which are in "Terminé"and store it in X

I count the number total of Controle and store it in Y.

Finally, I do X/Y and put it in the tooltips but it don't work because the context filter the data either "En cours" either "Terminé", it depends where you put your mouse in.

 

Do you know how can I fix it ? there are maybe a dax fonction to ignore the context in order to calculate my measure

 

Thank you guys !!!

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous, 

     

    Please try this measure:

    Measure
    =
    DIVIDE (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Controle ] = MAX ( 'Table'[Controle ] )
                    && 'Table'[Status] = "Termine"
            )
        ),
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', 'Table'[Controle ] = MAX ( 'Table'[Controle ] ) )
        )
    )

    Here is the pbix file.

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.

     

    Best Regards,
    Eyelyn Qin

3 Replies

  • This is not the most elegant solution but it will work.

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Can  I ask why did you do +0 at the beginning of Return ?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous, 

     

    Please try this measure:

    Measure
    =
    DIVIDE (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Controle ] = MAX ( 'Table'[Controle ] )
                    && 'Table'[Status] = "Termine"
            )
        ),
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', 'Table'[Controle ] = MAX ( 'Table'[Controle ] ) )
        )
    )

    Here is the pbix file.

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.

     

    Best Regards,
    Eyelyn Qin