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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
straubja
Frequent Visitor

Highest value in measure with time binning

Hello,

 

I have a measure UL that totals the number of unit loads for a given time bin (daily, weekly, monthly) - see below.  The total value of all bars is 3156 and is displayed on a card.

 

straubja_0-1721999901828.png

 

As you can see from the chart, the highest bar value of UL is 812, but I don't know how to retrieve 812 using the measure. 

 

When I select the specific bar the measure does change to the correct amount, which tells me that I could maybe filter it somehow.

 

straubja_1-1722000240826.png

 

Is there anyone who knows how to fix this?  Much obliged.

 

5 REPLIES 5
straubj
New Member

Hello,

I tried doing the measure that @mickey64 suggested but I think that I don't fully understand the syntax.  I have attached a link https://drive.google.com/open?id=1_G6o9EW-mGjNZ9KoxwQfF9WFuewigadT&usp=drive_fs  here.   The data has been anonymized so the totals are a bit different but the concept is the same.

 

straubj_0-1722092562977.png

As you can see, the card shows the total value of the measure UL, but what I am looking for is the size of the largest column (in the case of monthly it would be 1510, but weekly it would 876 and daily it would be 550.

 

I appreciate all the help!

 

Regards

Julian

I was able to create Daily and Monthly measures, but I was unable to create a measure that switches with a slicer, as I don't understand the "Date-Bin" functionality you are using.

 

M_Maxx-Daily = MAXX(SUMMARIZE('data1','data1'[Daily],"M-UL",'data1'[UL]),'data1'[UL])

 

M_Maxx-Weekly = MAXX(SUMMARIZE('data1','data1'[Weekly],"M-UL",'data1'[UL]),'data1'[UL])

 

M_Maxx-Monthly = MAXX(SUMMARIZE('data1','data1'[Monthly],"M-UL",'data1'[UL]),'data1'[UL])

 

mickey64_0-1722140145784.png

 

Hello,

Thanks @mickey64 that was very helpful. 

 

With some applied research, I was able to put all three options into a SWITCH function to get the desired output, but it took some effort.

 

First, I was not able to directly access the selected value for the time bin, so a workaround is to add  DAX columns 'Bin' and 'Bin Field' that essentially copies the composite value and makes them retrievable by the SELECTEDVALUE function,

 

straubja_0-1722546641323.png

straubja_7-1722551806864.png

 

One that was done, I was able to create two measures [Selected Value] and [Selected Field] that retrieves the current bin and field name.

 

straubja_1-1722546769086.png

straubja_9-1722552196115.png

 

Finally, I was then able to use @mickey64 's function wrapped inside a SWITCH for the three types of bins available, using [Selected Value].

 

straubja_2-1722546892616.png

Now the highest value measure is displayed on the card and interacts dynamically with the bin slicer:

straubja_3-1722547023212.pngstraubja_4-1722547059534.pngstraubja_5-1722547092994.png

This solves the immediate issue, but I wanted to see whether I could pass the [Selected Field] measure displayed on the card into the second argument of the SUMMARIZE function to eliminate the SWITCH and make things dynamic.

straubja_10-1722552303008.png

 

I tried a bunch of different ways to make a measure [Highest Value no Switch] using the [Selected Field] in place of the second argument of @mickey64's function but it didn't work.  Evidently there isn't a DAX equivalent of the Excel INDIRECT function that would work here.  It appears that it is looking for a column name and can't accept a measure.

 

straubja_11-1722552406926.png

 

Any ideas on how I can overcome this?

Thanks

Julian

mickey64
Super User
Super User

Plese try this measure below.

 

M_Max = MAXX(SUMMARIZE('Table','Table'[Date],"MeasureValue",[Measure]),'DATA'[Measure])

Ritaf1983
Super User
Super User

Hi @straubja 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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