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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dunner2020
Post Prodigy
Post Prodigy

Maximum Value for measure

Hi there,

I have data which looks like as follow:

myasir_0-1602209026407.png

 

 

 

Column A,B, C, D are given. 

Column C is the 'Epoch Half Hour Number' which is a unique Id for a half-hour time period. Column E is the calculation that looked at the past 48 half-hour values. I calculated column E using the following measure: 
 
Past 24 hrs Values=
var Time30Min = MAX('Table'[Epoch Half Hour Number])
Return
SUMX(FILTER(filter(ALL('Table'),'Table'[Epoch Half Hour Number] <= Time30Min && 'Table'[Epoch Half Hour Number] >= Time30Min-47),'Table'[ConsumptionMinutes])/91577
 
Now I want to calculate another measure that picks the maximum value among 24 values generated by 'Past 24 hrs Values'.  Could anyone guide me on how to do that? Here is the link to the data file:
 
 

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @Dunner2020 

 

It’s my pleasure to answer for you.

Your data seems a bit confusing, but I still try to calculate the maximum(range is 24h)value from your data, First create an index table,then create a measure

Like this:
First create an index table

Measure 2 =
MAXX (
    FILTER (
        ALL ( 'Table' ),
        [Index] >= SELECTEDVALUE ( 'Table'[Index] )
            && [Index]
                <= SELECTEDVALUE ( 'Table'[Index] ) + 23
    ),
    'Table'[Past 24 hrs Values]
)

v-janeyg-msft_0-1602554040127.png

If it doesn’t solve your problems, please feel free to ask me.

 

Best Regards

Janey Guo

 

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-janeyg-msft
Community Support
Community Support

Hi, @Dunner2020 

 

It’s my pleasure to answer for you.

Your data seems a bit confusing, but I still try to calculate the maximum(range is 24h)value from your data, First create an index table,then create a measure

Like this:
First create an index table

Measure 2 =
MAXX (
    FILTER (
        ALL ( 'Table' ),
        [Index] >= SELECTEDVALUE ( 'Table'[Index] )
            && [Index]
                <= SELECTEDVALUE ( 'Table'[Index] ) + 23
    ),
    'Table'[Past 24 hrs Values]
)

v-janeyg-msft_0-1602554040127.png

If it doesn’t solve your problems, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

amitchandak
Super User
Super User

@Dunner2020 , I would advice convert it into datetime and work with that

 

#datetime(1970,1,1,0,0,0)+#duration(0,0,0,[Epoch]/1000)

 

In any time you add time like this in dax

Date + time(10,0,0)

@amitchandak , I don't think so that problem in the datetime format. Its is the requirement that's why I could not merge date with time column. I have updated picture and data for more clarification

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.