Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Naveen59
Regular Visitor

How to calculate Max-min for each day from a large dataset

Hi Team, 

I am new at power BI, I want to calculate Max-Min of each day and if there will be Zero then we have to ignore Zero and need to substract from values only, here is the sample data, please help me for this on urgent basis.

DateValues
8/23/202210:1057384.29
8/23/2022 9:40228375.3
8/23/2022 8:102529279
8/23/2022 7:50224606.7
8/23/2022 3:102529154
8/23/2022 2:501273840
8/23/2022 2:301273826
8/23/2022 1:402529154
8/23/2022 1:002529154
8/23/2022 0:40534695.1
8/22/2022 20:202529154
8/22/2022 20:001273508
8/22/2022 11:502528039
8/22/2022 11:3076444.75
8/22/2022 10:102527662
8/22/2022 9:50208444.8
8/22/2022 9:20228125
8/22/2022 7:20214431.5
8/22/2022 5:302526704
8/22/2022 5:1057302.12
8/22/2022 3:501272105
8/22/2022 1:402526514
8/22/2022 1:2057283.45
8/22/2022 0:102526442
8/21/2022 22:502526376
8/21/2022 22:401272097
8/21/2022 22:30496331.1
8/21/2022 21:302526311
8/21/2022 21:10496294.9
8/21/2022 17:202526105
8/21/2022 17:0057242.8
8/21/2022 16:202526054
8/21/2022 16:00496154.5
8/21/2022 13:102525844
1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @Naveen59 ,

Please try below steps:

1. create a new column with below dax formula

Date_v2 =
VAR _val = LEFT ( [Date], 9 ) RETURN DATEVALUE ( _val )

2. create two measure with below dax formula

Max Value =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date_v2] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date_v2] = cur_date )
RETURN
    MAXX ( tmp, [Values] )
Min Value =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date_v2] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date_v2] = cur_date )
RETURN
    MINX ( tmp, [Values] )

3. add a table visual with new column and measure

vbinbinyumsft_0-1667373107458.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-binbinyu-msft
Community Support
Community Support

Hi @Naveen59 ,

Please try below steps:

1. create a new column with below dax formula

Date_v2 =
VAR _val = LEFT ( [Date], 9 ) RETURN DATEVALUE ( _val )

2. create two measure with below dax formula

Max Value =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date_v2] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date_v2] = cur_date )
RETURN
    MAXX ( tmp, [Values] )
Min Value =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date_v2] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date_v2] = cur_date )
RETURN
    MINX ( tmp, [Values] )

3. add a table visual with new column and measure

vbinbinyumsft_0-1667373107458.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Naveen59
Regular Visitor

Hi amit, 

I have already tried this step but getting right value.

amitchandak
Super User
Super User

@Naveen59 , Create a date column in power query or bring it from source

 

date 1=  DateTime.Date([Date])

 

Use this in visual and take min/max of value as measures

 

Min val = min(Table[Values])

 

Max val = max(Table[Values])

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.