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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Calculate with 2 filters provides blank as a result

Hi, 

I want to get the latest value for a specific time and date, but when I apply two filters to my formula, it results in BLANK.  

I appreciate any tips on that:) . 

This is my calculation: 

Sensor Value latest = CALCULATE (
    fact_sensordata[Sensor Value],
    FILTER (
       ALL ( 'fact_sensordata'[date_id] ),
      'fact_sensordata'[date_id]
            = MAX ( 'fact_sensordata'[date_id] )
   ),
    FILTER (
    ALL ( 'fact_sensordata'[time_id] ),
    'fact_sensordata'[time_id]
   = MAX ( 'fact_sensordata'[time_id] )
   )
)
 
This is calculation for Sensor Value: 
Sensor Value = AVERAGE(fact_sensordata[sensorValue])

 

This is my fact table: 

 

sensor_idtime_iddate_idSensor value
1492511100
149261532
1512748877
3 REPLIES 3
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Sensor Value latest =
VAR T1 =
    SUMMARIZE (
        fact_sensordata,
        'fact_sensordata'[date_id],
        'fact_sensordata'[time_id],
        "@SensorValue", [Sensor Value]
    )
VAR T2 =
    TOPN (
        1,
        T1,
        'fact_sensordata'[date_id], DESC,
        'fact_sensordata'[time_id], DESC
    )
RETURN
    MAXX ( T2, [@SensorValue] )
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your full dataset looks like, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1662988678090.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
goncalogeraldes
Super User
Super User

Hello there @Anonymous ! Not sure if this is what you want but try this:

 

Sensor Value latest =
CALCULATE (
    AVERAGE( fact_sensordata[Sensor Value] ),
    ALL ( 'fact_sensordata'[date_id], 'fact_sensordata'[time_id] ),
    'fact_sensordata'[date_id] = MAX ( 'fact_sensordata'[date_id] )
        && 'fact_sensordata'[time_id] = MAX ( 'fact_sensordata'[time_id] )
)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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