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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
TornDigorn
Frequent Visitor

column for different values depending on the days of the week

Hello, 

 

I need to generate a "NEW CAGE" column - which will return the value 1 if the value in the "days between" column is 1, and in the case of (only Mondays) the difference in the "days between" column will be equal 1 and 2 (it is very important to generate this 1 in one column

 

currently 1 is returned in the "NEW CAGE" column if the "days between" column is 1 - I used following command NEW CAGE1 = IF(Table1[Days Between] = 1, "1")

 

The day name column contains the names of the days of the week that I generated using the command DayName = Format('Table1'[report date],"dddd")

pbix.PNG

poniedzialek = monday

3 ACCEPTED SOLUTIONS
selimovd
Super User
Super User

Hey @TornDigorn ,

 

I'm not completely sure if I understood the Monday case correct.

I understood that on Monday the "days between" can be 1 or 2, on the other days it has to be a 1. Is that correct?

 

In this case the following formula schould work:

NEW CAGE =
SWITCH (
    TRUE (),
    Table1[Days Between] = 1, 1,
    WEEKDAY ( Table1[report date] ) = 2 -- this means Monday
        && (
        Table1[Days Between] = 1 || Table1[Days Between] = 2
        ), 1
)

 

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

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

View solution in original post

Hi, @TornDigorn 

 

You can try the following methods.

Old Cage = SWITCH(TRUE(),
[Days between]=1,1,
[DayName]="Monday"&&[Days between]>=2,1)

vzhangti_0-1675649910624.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hey @TornDigorn ,

 

sure, that's just an adaption:

Old Cage =
SWITCH (
    TRUE (),
    Table1[Days Between] > 1, 1,
    WEEKDAY ( Table1[report date] ) = 2 -- this means Monday
        && Table1[Days Between] > 2, 1
)

 

Please don't forget to mark my post as solution if it provided the help to solve your issue. Like this the next person who will stumble across this post will easier find a solution.

 

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

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

 

View solution in original post

4 REPLIES 4
TornDigorn
Frequent Visitor

hello @selimovd 

 

That's thats exactly what i was looking for. Thank you ! 🙂 

 

Could I ask you for help in creating one more formula for the same sheet ?

I need a column named "Old Cage" to return 1 for :

- "days between" greater than 1

- unless it is Monday then "days between" greater than 2

As before, 1's should be displayed in one column

 

Thanks so much in advance !

Hey @TornDigorn ,

 

sure, that's just an adaption:

Old Cage =
SWITCH (
    TRUE (),
    Table1[Days Between] > 1, 1,
    WEEKDAY ( Table1[report date] ) = 2 -- this means Monday
        && Table1[Days Between] > 2, 1
)

 

Please don't forget to mark my post as solution if it provided the help to solve your issue. Like this the next person who will stumble across this post will easier find a solution.

 

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

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

 

Hi, @TornDigorn 

 

You can try the following methods.

Old Cage = SWITCH(TRUE(),
[Days between]=1,1,
[DayName]="Monday"&&[Days between]>=2,1)

vzhangti_0-1675649910624.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

selimovd
Super User
Super User

Hey @TornDigorn ,

 

I'm not completely sure if I understood the Monday case correct.

I understood that on Monday the "days between" can be 1 or 2, on the other days it has to be a 1. Is that correct?

 

In this case the following formula schould work:

NEW CAGE =
SWITCH (
    TRUE (),
    Table1[Days Between] = 1, 1,
    WEEKDAY ( Table1[report date] ) = 2 -- this means Monday
        && (
        Table1[Days Between] = 1 || Table1[Days Between] = 2
        ), 1
)

 

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

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.