Forum Discussion

dofrancis3's avatar
dofrancis3
Resolver I
2 years ago
Solved

Extract value by latest date using DAX

Hello colleagues!

Once again i comme to request your kindly support regrading the following:

I have already a measure (LQAS) which contain my percentage (in the first column) so, i would like a measure who will display only percentage of lates date highlight in yellow in the print screen below:

Note: I don’t like to calculate percentage but just display.

 

 

Thank you your help.

 

Fd.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi dofrancis3 ,
    Thank you Gabry  for your prompt reply. I have created a data example for you to solve the problem. You can follow the steps below:
    1. Add a measure.

    Colour = 
    VAR _maxdate =
        RANKX (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Country] = SELECTEDVALUE ( 'Table'[Country] )
            ),
            CALCULATE ( MAX ( 'Table'[Start date] ) ),
            ,
            DESC
        )
    RETURN
        IF ( _maxdate = 1, "yellow" )
    


    2. Put the measure into the fx in Visual.

    Final output:

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Hello,

    this should be the formula:

    Latest % =
    IF (
        selectedvalue('Table'[start date] )= CALCULATE(
                        max('Table'[start date]),
                        ALLEXCEPT('Table', 'Table'[Country])
                    ),
        % measure,
       blank
    )

    if  not working please paste your sample data as text and not as image. If it works please mark as accepted solution

    (I made a correction because I used Min but you are looking for the Max)
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dofrancis3 ,
    Thank you Gabry  for your prompt reply. I have created a data example for you to solve the problem. You can follow the steps below:
    1. Add a measure.

    Colour = 
    VAR _maxdate =
        RANKX (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Country] = SELECTEDVALUE ( 'Table'[Country] )
            ),
            CALCULATE ( MAX ( 'Table'[Start date] ) ),
            ,
            DESC
        )
    RETURN
        IF ( _maxdate = 1, "yellow" )
    


    2. Put the measure into the fx in Visual.

    Final output:

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.