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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jstanley1017
Frequent Visitor

create column data from multiple rows

I have a dataset that consists of many applications that are grouped by what we call an SRU Name. (many to one relationship between App ID and SRU Name). I would like to create an SRU Tier, SRU RTO and SRU Resilience based upon the applications that are associated with each SRU Name. For example for SRU Name=S1, SRU Tier=1 (need the min value), SRU RTO=<15 minutes (need min value), Resilience=AP (where we take the lowest value from AA, AS, AP). I am seeking to have the columns in red calculated (if possible)

 

App IDTierRTOResilienceSRU NameSRU TierSRU RTOSRU Resilience
A12<30 minutesAAS11<15 minutesAP
A23<4 hoursAPS11<15 minutesAP
A31<15 minutesASS11<15 minutesAP
A44<8 hoursAPS11<15 minutesAP
A54<8 hoursAPS21<15 minutesAP
A61<30 minutesRRS21<15 minutesAP
A75<72 hoursASS32<30 minutesAS
A84<8 hoursASS32<30 minutesAS
A92<30 minutesASS32<30 minutesAS
A102<30 minutesAAS32<30 minutesAS

Is there a way to code for something like this?

 

I am happy to add the notebook, but I am not sure how. 😟

 

 

1 ACCEPTED SOLUTION

Mine is a calculated column formula.  The EARLIER() function works only in a calculated column formula.


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

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

SRU Tier = CALCULATE(MIN(Data[Tier]),FILTER(Data,Data[SRU Name]=EARLIER(Data[SRU Name])))

Ashish_Mathur_0-1733365358926.png

 


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

hello @jstanley1017 

 

please check if this accomodate your need.

Irwan_0-1733272840584.png

1. since your 'RTO' might be in text form, you need to change this into number so you can get time order for 'SRU RTO'. there are plenty way to do this, but i did this in the simplest way. i used PQ to split number and time unit to get 'Time Duration' in minutes.

 

2. 'SRU Tier', i assumed you want to get the lowest 'Tier' for same 'SRU Name'

SRU Tier = 
MINX(
    FILTER(
        'Table',
        'Table'[SRU Name]=EARLIER('Table'[SRU Name])
    ),
    'Table'[Tier]
)
 
3. 'SRU RTO', i assumed you want to get the lowest 'RTO' category for same 'SRU Tier'
SRU RTO =
MINX(
    FILTER(
        'Table',
        'Table'[SRU Tier]=EARLIER('Table'[SRU Tier])
    ),
    'Table'[RTO]
)
since 'RTO' might be in text form, you most likely can not do MINX directly so you need to create another calculation for 'Time Duration' as i mentioned above.
'SRU RTO' basically seeks the lowest 'Time Duration' on every same 'SRU Tier' then returns as 'RTO' value (text form).
 
then for 'SRU Resilience', i dont know how to determine AP or AS.
you mentioned in your post, where we take the lowest value from AA, AS, AP. But what value to get the lowest?
 
Hope this will help.
Thank you.

I am getting an error when trying to use the SRU Tier or SRU RTO code.

 

jstanley1017_1-1733326297852.png

Am I doing this wrong?

hello @jstanley1017 

 

the code is for DAX, not PQ.

after you have your data in PBI, then create a calculated column and paste the DAX.

 

also, if you have custom sort for Resilience, then it might be better to do indexing by RANK or RANKX depend on what value you have in custom sort.

 

Hope this will help.

Thank you.

I am getting an error from the EARLIER function.

 

jstanley1017_0-1733416466228.png

EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

hello @jstanley1017 

 

as @Ashish_Mathur mentioned, EARLIER works only in calculated column. You got that error because you put EARLIER in measure not calculated column.

 

create a calculated column for 'SRU Tier' and 'SRU RTO' then use either my DAX or @Ashish_Mathur 's DAX with changes based on your table and column name (either DAX should be fine depend on your preferences DAX).

 

Thank you.

Mine is a calculated column formula.  The EARLIER() function works only in a calculated column formula.


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

Thanks Irwan! For the last part, we have a custom sort with Resilience sorted from high AA (high), AS, AP (low). I am guess I would have to assign values to these for sorting purposes.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.