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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Convert Measure Formula into Calculated Column

Hello All,

 

In my table i have the timelog details for each empployees.

So i am trying to calculate the count of days that each employee not entered the timelog i.e the blank rows.

 

By using below formula as a measure i got right the values.

 

 

EmpCount = CALCULATE(COUNTROWS(Timelog),FILTER(Timelog,Timelog[Time Log]=BLANK()))

* Intentionally Emp Names are colored as white* Intentionally Emp Names are colored as white

 

As you can see in above image, that there are three slicers(Date, Emp Name & SBU) which will be using as filters for the same.

And by measure it is filtering the table values perfectly.

 

Now I am trying get these emp count values into some ranges like 0-5, 5-10, 10-15,>15.
I did it in measure using switch function. but i cant use this switch measure in column bar chart's AXIS field as it needs only a column.

 

So, now how can i write a calculated column which can give me the same result as the above measure is giving so that i can write a ranges calculated column further.

 

Any help.

 

Mohan V

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 


 Now I am trying get these emp count values into some ranges like 0-5, 5-10, 10-15,>15.
I did it in measure using switch function. but i cant use this switch measure in column bar chart's AXIS field as it needs only a column.

 

So, now how can i write a calculated column which can give me the same result as the above measure is giving so that i can write a ranges calculated column further.

 


 

Please modify the measure for [EmpCount] as below:

EmpCount =
CALCULATE (
    COUNTROWS ( Timelog ),
    FILTER (
        ALLEXCEPT ( Timelog, Timelog[Emp Name] ),
        Timelog[Time Log] = BLANK ()
    )
)
_Column =
IF (
    [EmpCount] < 5,
    "0-5",
    IF (
        [EmpCount] >= 5
            && [EmpCount] < 10,
        "5-10",
        IF ( [EmpCount] >= 10 && [EmpCount] < 15, "10-15", ">15" )
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

5 REPLIES 5
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 


 Now I am trying get these emp count values into some ranges like 0-5, 5-10, 10-15,>15.
I did it in measure using switch function. but i cant use this switch measure in column bar chart's AXIS field as it needs only a column.

 

So, now how can i write a calculated column which can give me the same result as the above measure is giving so that i can write a ranges calculated column further.

 


 

Please modify the measure for [EmpCount] as below:

EmpCount =
CALCULATE (
    COUNTROWS ( Timelog ),
    FILTER (
        ALLEXCEPT ( Timelog, Timelog[Emp Name] ),
        Timelog[Time Log] = BLANK ()
    )
)
_Column =
IF (
    [EmpCount] < 5,
    "0-5",
    IF (
        [EmpCount] >= 5
            && [EmpCount] < 10,
        "5-10",
        IF ( [EmpCount] >= 10 && [EmpCount] < 15, "10-15", ">15" )
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
quentin_vigne
Solution Sage
Solution Sage

Hi @Anonymous

 

Maybe you can try an If column? 

 

Something like : 

 

IF(EmpCount<5;"0-5";IF(EmpCount<10;"5-10";IF(EmpCount<15;"10-15";">15")))

- Quentin

Anonymous
Not applicable

@quentin_vigne Thanks for the  reply.

 

I have already tried that, but im getting wrong output as in below image.

Calulated column formula

_Column = IF([EmpCount]<5,"0-5",IF([EmpCount]>=5 && [EmpCount]<10 ,"5-10",IF([EmpCount]>=10 && [EmpCount]<15,"10-15",">15")))

Capture.PNG

In measure it is givng perfect values.

_Measure= 
IF([EmpCount]<5,"0-5",IF([EmpCount]>=5 && [EmpCount]<10 ,"5-10",IF([EmpCount]>=10 && [EmpCount]<15,"10-15",">15")))

Capture.PNG

 

But as i said i cant use this measure in bar chart axis feild..
Any suggestions Please.

 

Mohan V

@Anonymous

 

Can you copy and paste this one : 

 

New_Column = IF([EmpCount]<5,"0-5",IF([EmpCount]<10 ,"5-10",IF([EmpCount]<15,"10-15",">15")))

You don't need the && condition because If goes from one level to another.

 

If it is still not working, is [EmpCount] the SAME thing that "Count of Emp No" on your snapshot ?

 

- Quentin

Anonymous
Not applicable

@quentin_vigne

 

Still no luck.

New_Column = IF([EmpCount]<5,"0-5",IF([EmpCount]<10 ,"5-10",IF([EmpCount]<15,"10-15",">15")))

getting the same Output.

 

Capture.PNG

If it is still not working, is [EmpCount] the SAME thing that "Count of Emp No" on your snapshot ?

Yes they are.


Any Help.

 

Mohan V

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.