Forum Discussion

VipulToshniwal's avatar
6 years ago
Solved

Finding the maximum temperature recorded for a day

Hi all,

 

I have a dataset that contains timestamps and temperature. I am interested in finding the maximum temperature recorded for each day for last week. The data recorded in about every 2 mins. The relative date slicers are not applicable as it does not help if the dataset is not refreshed. 

Please help me on how to do this with DAX. Thanks.

Regards,

Vipul Toshniwal

PS

 

 

  • Hi VipulToshniwal ,

    You can try this measure to achieve maximum temperature of a day:

     

    Max_temperature of current day =

    VAR _curr =

        SELECTEDVALUE ( 'Table'[timestamp_IST] )

    RETURN

        CALCULATE (

            MAX ( 'Table'[Temperature] ),

            FILTER (

                ALL ( 'Table' ),

                YEAR ( 'Table'[timestamp_IST] ) = YEAR ( _curr )

                    && MONTH ( 'Table'[timestamp_IST] ) = MONTH ( _curr )

                    && DAY ( 'Table'[timestamp_IST] ) = DAY ( _curr )

            )

        )

     

    You will get the result like this:

    Here is the demo, please try it:

    PBIX 

     

    Best Regards,

    Yingjie Li

     

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

2 Replies

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity Support

    Hi VipulToshniwal ,

    You can try this measure to achieve maximum temperature of a day:

     

    Max_temperature of current day =

    VAR _curr =

        SELECTEDVALUE ( 'Table'[timestamp_IST] )

    RETURN

        CALCULATE (

            MAX ( 'Table'[Temperature] ),

            FILTER (

                ALL ( 'Table' ),

                YEAR ( 'Table'[timestamp_IST] ) = YEAR ( _curr )

                    && MONTH ( 'Table'[timestamp_IST] ) = MONTH ( _curr )

                    && DAY ( 'Table'[timestamp_IST] ) = DAY ( _curr )

            )

        )

     

    You will get the result like this:

    Here is the demo, please try it:

    PBIX 

     

    Best Regards,

    Yingjie Li

     

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