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
badgerpackerfan
New Member

Using MAX to generate summary visuals

Background:  I'm an engineer with no prior experience with this tool or data visualization in general.  I have some data that I want to present on a dashboard that shows our current status.  I've created a few visuals but haven't figured out how to generate the charts to only visualize the latest data.  What I really want is to grab the latest (which maybe different) score from each tb_id to cacluclate the most current average for the 2 bar charts.

 

Here is my powerbi workbook:

https://drive.google.com/file/d/1oItnqZTkylQnQSOHH1tp5NhVrJbHspFh/view?usp=sharing

 

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@badgerpackerfan

I really don't get it."Most current average for 2-bar charts, do you mean you want average score by 3 groups? (tb id, entity ID, and subsystem ID)

But if you want to filter the visuals to the most recent date, you can use the TOPN filter.

filter to latest time.JPG

Paul Zheng Community Support Team _
If this post helps, please consider accepting it as the solution to help other members find it more quickly.

I tried the expression above and it looked close but wasn't exactly what I wanted as one of the data points had a score over 100 which isn't possible.  Is there a way to get the table output of a DAX expression to see what it does?  It was close but I'm not sure how to debug it.  I'd like to see what each part of the expression pulls out of the original table.

 

Top N didn't work the way I wanted to because it only looks at timestamp.  You'll notice one of the rows has 5/2/2020 instead of 5/1/2020.  When I did that, Top N only returned the 5/2 entry.

 

Below is a tablee of what I want to get out for the visuals.  Here's some pseudo code:

 

foreach(feature_id)

  find row with latest timestamp foreach(tb_id)

 

tb_idfeature_idscoretimestampsubsystem_id
221555/1/20 0:004
231655/1/20 0:004
241675/1/20 0:004
271705/2/20 0:004
311785/1/20 0:005
191695/1/20 0:003
371725/1/20 0:003
381755/1/20 0:003
65845/1/20 0:001
195755/1/20 0:003
205865/1/20 0:003
215895/1/20 0:003
275995/1/20 0:004
365835/1/20 0:003
375795/1/20 0:003
385825/1/20 0:003
camargos88
Community Champion
Community Champion

Hi @badgerpackerfan ,

 

Try this measure:

 

_AVX =
AVERAGEX(ADDCOLUMNS(SUMMARIZE('status'; 'status'[tb_id]; "Max"; MAX('status'[timestamp])); "Score"; CALCULATE(SUM('status'[score]); FILTER('status'; 'status'[tb_id] = EARLIER('status'[tb_id])))); [Score])
 
Did I answer your question? Mark my post as a solution!
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.