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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ClaireBear
Helper I
Helper I

How to decode an enum - Bitwise Operations using flag enums for weekdays

Hi, 

I have received a dataset that includes flag enums to tell me what days of the week an employee works. 

I know that:

flag enum 62 means that an employee works Monday to Friday

flag enum 126 means that an emploee works Monday to Saturday and,

flag enum 127 the employee works Monday to Sunday.

 

How do i work this into power bi to decode the enum flag value?

How do i add all combinations with the values for the days of the week? Say someone only works Monday and Tuesday?

I have searched and read up on bitwise operators but nothing comes up on how to decode the enum value in power bi

 

1 - Monday - 1

2 - Tuesday - 2

3 - Wednesday - 4

4 - Thursday - 8

5 - Friday - 16

6 - Saturday - 32

7 - Sunday - 64

 

 Is anyone able to give me some guidence? This is very new to me.

 

Thank you!

4 REPLIES 4
ClaireBear
Helper I
Helper I

Hi @Anonymous 

Thank you so much for your response. 

The DayID in the table below is the enum that i need to decode for the days of the week worked, being Monday to Sunday.  So i need to figure out which days of the week value 62 (for example) is.
Im not sure if there is a calculation that can be done in power bi that decodes these values? 
If not, i suppose the solution would be to find out what days these values represent and build a look up table. 

 

ClaireBear_0-1631258497611.png

 

Anonymous
Not applicable

Hi @ClaireBear ,

I'm afraid that DAX can't implement such a feature, just by using a numerical value to invert the days when the employees work. Besides the table you provided above, are there any other tables in your model associated with this table? I would like to try to see if there is any other information that can be used as an aid to get the days of the week that employees work.

Best Regards

Anonymous
Not applicable

Hi @ClaireBear

I don't quite understand your requirement. Are you trying to invert what day of the week each employee works each week based on the sum of the flag enum for each weekday? But again, based on the information you provided, that doesn't seem quite right. For example, flag enum 62 means that an employee works Monday to Friday. In the table below, the values obtained from Monday to Friday are (1+2+4+8+16)=31 not 62...

1 - Monday - 1

2 - Tuesday - 2

3 - Wednesday - 4

4 - Thursday - 8

5 - Friday - 16

6 - Saturday - 32

7 - Sunday - 64

Could you please share the sample data in your model and the results you expect in order to provide you a suitable solution? Also provide a screenshot of the exact calculation logic and the relevant example. Thank you.

Best Regards

I suspect the enum is actually: 

1 - Sunday - 1

2 - Monday - 2

3 - Tuesday - 4

4 - Wednesday - 8

5 - Thursday - 16

6 - Friday - 32

7 - Saturday - 64

 

Where: Monday to Friday is (2+4+8+16+32)=62.

 

@ClaireBear can you clarify so that we can help?  Thank you.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors