cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ovidijus
Frequent Visitor

Date time subtraction

Hello Pbix`ers,

 

Struglling with measure creation.

 

Have two subtract value lik ein picture?

 

Ovidijus_0-1685619115048.png

 

2 REPLIES 2
amitchandak
Super User
Super User

@Ovidijus , Try like

 

new measure =
var _max = maxx(filter(allselected(Table), Table[Meter Number] = max(Table[Meter Number]) && Table[Date] < max(Table[Date])), Table[Date] )
return
sum( Table[Value]) - sumx(filter(allselected(Table), Table[Meter Number] = max(Table[Meter Number]) && Table[Date] = _max), Table[Value] )

 

 

or

 

new measure =
var _max = maxx(filter(allselected(Table), Table[Meter Number] = max(Table[Meter Number]) && Table[Date] < max(Table[Date])), Table[Date] )
return
sum( Table[Value]) - sumx(filter((Table), Table[Date] = _max), Table[Value] )

Hey, solution probably would work but i played a little yesterday and need this visual as in the top table.

 

Need to see calculated values from Meters minus 12 hours.

 

That would be massive help to solve 🙂

 

Ovidijus_0-1685689000809.png

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors