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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Convert row into value

Dear DAX collegues,

 

I stumbled over a - maybe - trivial problem, but cannot solve it:

 

I'd like to create a measure that give the name of the product with max production duration per day.

I've got one table that has [Product], [Minutes] and [Date]

The second table shows the used raw materials per Date - here I'd like to create the measure.

 

For a given day, I have e.g. three product produced:

A   340 min

B   700 min

C  194 min

 

I tried to use TopN(1;'Products;Products[Minutes];DESC)) to give the top 1 row of the products (= B | 700 min).

But now, this result is obviously a single row, but what I do like to have now is just the value "B".

 

Thanks in advance for your ideas!

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

you can use the syntax you posted as filter parameter in CALCULATE

Measure = 
VAR Top1 = TopN(1,'Products',Products[Minutes],DESC)
RETURN
CALCULATE(FIRSTNONBLANK(Products[Product],TRUE),Top1)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

3 REPLIES 3
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may try to use below measure:

Measure =
CALCULATE (
    VALUES ( 'Product'[Product] ),
    TOPN ( 1, 'Product', 'Product'[Minutes], DESC )
)

 

Regards,

Cherie 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Stachu
Community Champion
Community Champion

you can use the syntax you posted as filter parameter in CALCULATE

Measure = 
VAR Top1 = TopN(1,'Products',Products[Minutes],DESC)
RETURN
CALCULATE(FIRSTNONBLANK(Products[Product],TRUE),Top1)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Great! Works absolutly fine!

Thanks, Stachu!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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