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
v_mark
Helper V
Helper V

Convert Calc Col Switch as a measure

I was trying to convert this calculated column into a measure.
 
Task Bucket = SWITCH( TRUE(),
Task[Aged] <= 1, "<24hrs",
Task[Aged] <= 3, "<72hrs",
Task[Aged] >= 3, ">72hrs")
 
Any workaround for this type of approach? TIA


2 ACCEPTED SOLUTIONS
selimovd
Super User
Super User

Hey @v_mark ,

 

a calculated column and a measure are 2 different concepts. You cannot always convert one to another, otherwise there would not be a reason to have both.

In your case you create a value by each row. If you do that as a measure you lose abilities that a calculated column has, like filtering by that value.

 

So the real question is what exactly do you want to do?

 

Otherwise you can easily transform that into a measure, I'm just not sure if you can use it then:

Task Bucket =
SWITCH(
    TRUE(),
    MAX(Task[Aged]) <= 1, "<24hrs",
    MAX(Task[Aged]) <= 3, "<72hrs",
    MAX(Task[Aged]) >= 3, ">72hrs"
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

Anonymous
Not applicable

Hi @v_mark ,

First, please make sure the field Task[Aged] will be put on your visual. Then you can create the measure as below to replace the original caculated column [Task Bucket]:

Measure =
IF (
    SELECTEDVALUE ( Task[Aged] ) <= 1,
    "<24hrs",
    IF ( SELECTEDVALUE ( Task[Aged] ) <= 3, "<72hrs", ">72hrs" )
)

yingyinr_0-1627289463858.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @v_mark ,

First, please make sure the field Task[Aged] will be put on your visual. Then you can create the measure as below to replace the original caculated column [Task Bucket]:

Measure =
IF (
    SELECTEDVALUE ( Task[Aged] ) <= 1,
    "<24hrs",
    IF ( SELECTEDVALUE ( Task[Aged] ) <= 3, "<72hrs", ">72hrs" )
)

yingyinr_0-1627289463858.png

Best Regards

selimovd
Super User
Super User

Hey @v_mark ,

 

a calculated column and a measure are 2 different concepts. You cannot always convert one to another, otherwise there would not be a reason to have both.

In your case you create a value by each row. If you do that as a measure you lose abilities that a calculated column has, like filtering by that value.

 

So the real question is what exactly do you want to do?

 

Otherwise you can easily transform that into a measure, I'm just not sure if you can use it then:

Task Bucket =
SWITCH(
    TRUE(),
    MAX(Task[Aged]) <= 1, "<24hrs",
    MAX(Task[Aged]) <= 3, "<72hrs",
    MAX(Task[Aged]) >= 3, ">72hrs"
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
CNENFRNL
Community Champion
Community Champion

Task Bucket =
SWITCH(
    TRUE(),
    MAX( Task[Aged] ) <= 1, "<24hrs",
    MAX( Task[Aged] ) <= 3, "<72hrs",
    ">72hrs"
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.