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

Need help to create a new measure with maximum values from multiple hits

I am quite new in Power BI and trying to build a dashboard that gives me the no of days taken to finish one item. Data is structured like, we have the item number and against that, we have time taken to produce an individual item and I want to pick it up as a new measure which gives me the maximum time taken for an item. Below is the screenshot of the data structure. Any help will be highly appreciated.

Like here there are 13 items of Item Number 100000004301 that were produced last week and each took different times, I want to pick up the value of the item which took a maximum of days.

Item NoDays took to complete
1000000043010.59
1000000043010.73
1000000043010.73
1000000043010.73
1000000043010.73
1000000043010.77
1000000043010.83
1000000043011.68
1000000043013.77
1000000043013.77
1000000043012.56
1000000043013.77
1000000043013.77
1000000043020.01
1000000043020.99
1000000043020.99
1000000043020.99
1000000043020.99
1000000043020.99
1000000043023.91
1000000043023.97
1000000043025.76
1000000043025.76
1000000043024.89
1000000043025.69
1000000043025.76
1 ACCEPTED SOLUTION

@Anonymous So if you put the Item No in a table visual and that measure it will give you the max days to complete. Is the problem the summarization or the "last week" part or that you want it in a string of text? If the latter, it would be:

Measure =
  CONCATENATEX(SUMMARIZE('Table',[Item No],"__Max",MAX([Days took to complete])),[Item No] & " " & [__Max],"; ")

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Have you tried Greg's new measure? It should work. As a measure is expected to return a single scalar value, you need to use CONCATENATEX function to combine multiple values. 

 

Or if you want to show max values in a new table, you can use the SUMMARIZE part expression. 

Table 2 = SUMMARIZE('Table',[Item No],"__Max",MAX('Table'[Days took to complete]))

vjingzhang_0-1643784680283.png

 

Best Regards,
Community Support Team _ Jing

Greg_Deckler
Super User
Super User

@Anonymous Measure = MAX([days took to complete])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Sorry this is not working for the things, which I am looking for. I am looking at Itemwise maximum days taken. e.g. For last week, we made 13 items of Item Number 100000004301 and each item took a different time. Now I want an outcome that says that Item No 1 - Max day y; Item no 2 - max day - z etc.

@Anonymous So if you put the Item No in a table visual and that measure it will give you the max days to complete. Is the problem the summarization or the "last week" part or that you want it in a string of text? If the latter, it would be:

Measure =
  CONCATENATEX(SUMMARIZE('Table',[Item No],"__Max",MAX([Days took to complete])),[Item No] & " " & [__Max],"; ")

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous ,

assume you have mesasure - maximum of days

for last week create another measure like
Last Week = CALCULATE([maximum of days], FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))


Then try TOP 1=
calculate([Last Week],TOPN(1,allselected(table[Item No]),[Last Week],desc), values(table[Item No]))

 

 

for last week refer

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8

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.