Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello everyone,
I need a PBI expert's help. Please refer to the table I've copied over. I need to generate a table of custom dates and information. Essentially using this table, I need DAX to generate a table/list of all Mondays [DDD] from the 1st week of the month [Month_Week_Num] for the given timeframe [Block Effective Start Date] - [Block Effective End Date] for each of the [Surgeons] which I've blinded.
I think it's a matter of using a combination of FILTER CROSSJOIN UNION, etc but I can't seem to get it to work.
For instance, just looking at Surgeon 1, the table should look like:
1/3 Mon Surgeon A
2/7 Mon Surgeon A
3/7 Mon Surgeon A
4/4 Mon Surgeon A
5/2 Mon Surgeon A
6/6 Mon Surgeon A
1/3 Mon Surgeon B
2/7 Mon Surgeon B
3/7 Mon Surgeon B
4/4 Mon Surgeon B
5/2 Mon Surgeon B
6/6 Mon Surgeon B
Any help would be appreciated.
Solved! Go to Solution.
@vapid128 I think you are getting closer!
The photo I attached is a better explanation of what I am looking for and I think you are on the right track of using GENERATE/GENERATESERIES. Example (referring to the photo)....The table on the left is the schedule table that is manually entered, the table on the right is what I would like to generate.
Example: Employee A, was scheduled to work on the Monday of the 1st week of every month between Start Date 1/1/2022 and end date 6/30/2022. Employee B was scheduled to work on every third Tuesday between his start date 5/1/2022 and 7/1/2022. Employee C was scheduled to work on every 2nd Thursday from 2/1/2022 to 5/30/2022.
This is awesome @vapid128 ! One question, how is [Values] generated? These are all new concepts to me so I'm interested in learning more! Thanks again! You've been extremely helpful!
It is a combo formule
GENERATE(Table,GENERATESERIES(start number from table, end number from table))
I create a index: year*12+month
If we use YYYYMM like 202201 to 202206, it will generate 202201/202202/202203/202204/202205/202206.
When your date is from 202112 to 202206 it will generate 202112/202113/202114/..../202206.
Therefore, we need rewirte this to year*12+month as a index.
And use
@vapid128 I have Start_Date starting from previous years. Any year < 2022 is giving block_day a blank. Suggestions?
If the blank is in block_day colnum,
that is because
return IF(_block_day>=[Start_date] && _block_day<=[End_date],_block_day,BLANK())
Thanks for replying! The table I attached will eventually have different variations of Weeks and Days, so for instance the table in the attachment will have the second Tuesday of the month, third Thursday of the month, etc... so how should build it?
updated solution
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
25 | |
20 | |
18 | |
17 | |
16 |
User | Count |
---|---|
34 | |
21 | |
19 | |
18 | |
11 |