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
Anonymous
Not applicable

Converting a Measure to a Calculated Column

Hi all,

 

I have a measure which tells me the last unitname per eventid. 

Here is the measure: 

 

CollinSharp1_0-1641826075674.png

 

I am looking to convert this into a calculated column so I can make this into a barchart. I want the unit name to be the x axis.

 

Does anyone have any solutions on how to do this?

 

Thanks!

 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , You need a new column like this

var _max = maxx(filter(Table, [Event_idx] =earlier([Event_idx]) ),[ActionDate])
return
maxx(filter(Table, [Event_idx] =earlier([Event_idx]) && [ActionDate] =_max ),[unit Name])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

smpa01
Super User
Super User

@Anonymous  use the same measure expression for the calculated column but add a CALCUATE in the beginning

Column =
CALCULATE (
    CALCULATE (
        MAX ( 'Crew Actions'[UNITNAME] ),
        FILTER (
            'Crew Actions',
            'Crew Actions'[ACTIONDATE]
                = CALCULATE (
                    MAX ( 'Crew Actions'[ACTIONDATE] ),
                    ALLEXCEPT ( 'Crew Actions', 'Crew Actions'[EVENT_IDX] )
                )
        )
    )
)

 

 

 

smpa01_0-1641827776028.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

3 REPLIES 3
smpa01
Super User
Super User

@Anonymous  use the same measure expression for the calculated column but add a CALCUATE in the beginning

Column =
CALCULATE (
    CALCULATE (
        MAX ( 'Crew Actions'[UNITNAME] ),
        FILTER (
            'Crew Actions',
            'Crew Actions'[ACTIONDATE]
                = CALCULATE (
                    MAX ( 'Crew Actions'[ACTIONDATE] ),
                    ALLEXCEPT ( 'Crew Actions', 'Crew Actions'[EVENT_IDX] )
                )
        )
    )
)

 

 

 

smpa01_0-1641827776028.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

You really are a super user. Thank you for this! 

amitchandak
Super User
Super User

@Anonymous , You need a new column like this

var _max = maxx(filter(Table, [Event_idx] =earlier([Event_idx]) ),[ActionDate])
return
maxx(filter(Table, [Event_idx] =earlier([Event_idx]) && [ActionDate] =_max ),[unit Name])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Top Solution Authors