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
Anonymous
Not applicable

Have measure show same constant value for all rows in a table

Hi,

 

I have a dataset that looks like this:

idtimestamptemperaturefirst reading
11/1/20 1:00 AM14TRUE
11/1/20 2:00 PM12.4FALSE
11/1/20 8:00 AM16.3FALSE
11/2/20 1:00 AM14.2FALSE
11/2/20 2:00 PM15.9FALSE
11/2/20 8:00 AM14.5FALSE
11/3/20 1:00 AM13.2FALSE
11/3/20 2:00 PM19.3FALSE
11/3/20 8:00 AM16.9FALSE
21/1/20 1:00 AM14.3TRUE
21/1/20 2:00 PM12.4FALSE
21/1/20 8:00 AM16.3FALSE
21/2/20 1:00 AM14.2FALSE
21/2/20 1:00 PM15.9FALSE
21/2/20 8:00 AM14.5FALSE
21/3/20 2:00 AM13.2FALSE
21/3/20 1:00 PM13.5FALSE
21/3/20 8:00 AM16.9FALSE

 

Where first reading is a calculated column to find the first temperature value, which looks like this:

first reading = IF(tabledb[timestamp]=CALCULATE(MIN(tabledb[timestamp]),ALLEXCEPT('tabledb', 'tabledb'[id])),True)
I then created a measure to get the first reading value of temperature like this:
First Reading Temperature = CALCULATE(SUM(tabledb[temperature]), tabledb[first reading] = TRUE())
 
This will only allow me to show first reading temperature on the excact time, is it possible to have it shown on all rows of the table as shown below?
 
DateTemperaturefirst reading temp
1/1/20201414
1/1/202012.414
1/1/202016.314
1/2/202014.214
1/2/202015.914
1/2/202014.514
1/3/202013.214
1/3/202019.314
1/3/202016.914

 

 

Thanks!

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

@Anonymous ,

 

Please modify the measure using dax below:

First Reading Temperature = 
VAR Current_id = MAX('Table'[id])
VAR Current_temp = CALCULATE(MAX('Table'[temperature]), FILTER(ALL('Table'), 'Table'[id] = Current_id && 'Table'[first reading] = TRUE()))
RETURN
IF(MAX('Table'[id]) = Current_id, Current_temp)

Capture.PNG 

Community Support Team _ Jimmy Tao

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

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Please modify the measure using dax below:

First Reading Temperature = 
VAR Current_id = MAX('Table'[id])
VAR Current_temp = CALCULATE(MAX('Table'[temperature]), FILTER(ALL('Table'), 'Table'[id] = Current_id && 'Table'[first reading] = TRUE()))
RETURN
IF(MAX('Table'[id]) = Current_id, Current_temp)

Capture.PNG 

Community Support Team _ Jimmy Tao

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

Try

MINX(filter(Table,Table[date]<=EARLIER(Table[date])),Table[Temperature])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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.