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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Ayoeri
Frequent Visitor

Copying the "First" behavior of a value in a calculated column

First of all, I'm very new to PowerBi but I have no one in my organization to help and my google effords did not get me any further. Sorry if my question is super basic.

I've got below table:

Ayoeri_1-1718142197402.png

 

For the each distinct project, I'm trying to calculate the lowest status of all the items Sub items in that project. If I make a table in the report view and put "Status" as value and list the summarization as "First" instead of count it gives me exactly what I want:

Ayoeri_2-1718142232091.png

 

However, I tried to copy this behavior in my main table by adding a calculated table so I would have the lowest value status for each line item in a project.

Ayoeri_3-1718142340426.png

 

I tried this with FIRSTNONBLANK ([Table] 'Status', [Table] 'Project'). If I understood the documentation correctly, this should return the first Status of the project. But I can't get this to work as it keeps giving me all the lowest status of that line item (which is per definition the status of that line item), rather than lowest status of the project the line item is part of. Can anyone explain how I get this done? Am I approahing this problem the wrong way?

 

 



 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Lowest project status = calculate(min(Data[Status]),filter(Data,Data[Project]=earlier(Data[Project])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi @Ayoeri ,

First of all, many thanks to  for your very quick and effective replies.

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1718173937081.png

2.Create the new column to filter the lowest status.

Lowest Project status = CALCULATE(MIN('Table'[Status]), ALLEXCEPT('Table', 'Table'[Project], 'Table'[Sub Item]))

vjiewumsft_1-1718173958334.png

3.Besides, create the new measure to filter the lowest status.

Measure = MINX(FILTER(ALL('Table'), 'Table'[Project] = SELECTEDVALUE('Table'[Project])), 'Table'[Status])

vjiewumsft_2-1718173965593.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @Ayoeri ,

First of all, many thanks to  for your very quick and effective replies.

Based on my testing, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1718173937081.png

2.Create the new column to filter the lowest status.

Lowest Project status = CALCULATE(MIN('Table'[Status]), ALLEXCEPT('Table', 'Table'[Project], 'Table'[Sub Item]))

vjiewumsft_1-1718173958334.png

3.Besides, create the new measure to filter the lowest status.

Measure = MINX(FILTER(ALL('Table'), 'Table'[Project] = SELECTEDVALUE('Table'[Project])), 'Table'[Status])

vjiewumsft_2-1718173965593.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks. This worked.

As Step 3 from your solution was not using anything from step 2. So I removed the actions from Step 2 and the solution from Step 3 still worked. So it is not clear to me what the pupose was of Step 2?

Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Lowest project status = calculate(min(Data[Status]),filter(Data,Data[Project]=earlier(Data[Project])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks. This worked as well.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
danextian
Super User
Super User

Hi @Ayoeri 

Try this:

CALCULATE ( MIN ( tbl[status] ), ALLEXCEPT ( tbl, tbl[project], tbl[subitem] ) )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks for the response. Unfortunatly I could not get this to work. This gave me a repeat of the values in the status column (see screenshot below where I labelled your solution as "Trial Other"):

Ayoeri_0-1718214489986.png

 

vicky_
Super User
Super User

Check out this article regarding Row Context on SQLBI: https://www.sqlbi.com/articles/row-context-in-dax/
(And also explore some of the other pages in the DAX 101 series, as I find that they are a great intro to DAX)

 

To fix your issue - you need to change your calculation for calculated column to something like:

Lowest Project Status = CALCULATE(MIN('Table'[Status]), ALLEXCEPT('Table', 'Table'[Project]))

Note - unless you absolutely NEED a calculated column, best practive would be to use a measure instead (the DAX for the measure would be the same in this case).

Ayoeri
Frequent Visitor

Unfortunatly I could not get this to work. It just repeated the Status value.  Thanks for sharing the link.

The reason I was on the path of calculated columns was becuase I wanted to add this result in a hierachy. And this is not possible for measures if I'm not mistaken.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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