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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ShibuyaSoo
Frequent Visitor

Hierarchy Date Parent-Child Categorical

Hi guys, need help to fix my problem. My date is based on day start with Friday and end on Thursday

 
Date Week Starts Friday =
  VAR Friday = WEEKDAY('Calendar'[Date], 2)
  RETURN 'Calendar'[Date] + IF(Friday > 4, 5, -2) - Friday
 
However, when I create a hierarchy slicer with just regular date to be its child. There are few months that have Parent (belong to previous month) but Child (current month). How can I fix the parent date name follow child date
 
ShibuyaSoo_0-1715065003112.png

 

 
1 ACCEPTED SOLUTION

@ShibuyaSoo You can add a column with this DAX and use it as the parent.

Date Week Starts Friday 2 = 
  VAR Friday = WEEKDAY('Calendar'[Date], 2)
  VAR weekStartDate = 'Calendar'[Date] + IF(Friday > 4, 5, -2) - Friday
  RETURN MAX(weekStartDate, STARTOFMONTH('Calendar'[Date]))

vjingzhanmsft_0-1715155100587.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

 

View solution in original post

5 REPLIES 5
ShibuyaSoo
Frequent Visitor

@v-jingzhan-msft ,Yes your result same as mine, my idea is to change the parent name follow with min date of its child. For example from your result:

 

March : 3/29/2024 (Parent) : 29/30/31 (Child)

April : 3/29/2024 (Parent) : 1/2/3/4 (Child)

 

is it possible on April, Parent name follow the min date of its child?. Because I saw the date patern for example Feb to Mar they do not have issue with financial date, Parent name = min date child.

@ShibuyaSoo You can add a column with this DAX and use it as the parent.

Date Week Starts Friday 2 = 
  VAR Friday = WEEKDAY('Calendar'[Date], 2)
  VAR weekStartDate = 'Calendar'[Date] + IF(Friday > 4, 5, -2) - Friday
  RETURN MAX(weekStartDate, STARTOFMONTH('Calendar'[Date]))

vjingzhanmsft_0-1715155100587.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

 

@v-jingzhan-msft , I tried & test with the data, It's working well for me & kudos to you bro 👏👍

v-jingzhan-msft
Community Support
Community Support

Hi @ShibuyaSoo 

 

This is due to that you are using the regular Month column as the parent of "Date Week Starts Friday" column in the slicer. I can reproduce the same behavior as below. I think this is the correct result based on the current selected columns. 

vjingzhanmsft_0-1715137045428.png

 

If you want to fix the parent date name, you need to have an additional column to have those fix names. Then use the fix column as the parent of regular date in the slicer. But if you do that, the fix week start dates for some weeks may not be their correct week start dates as the correct ones do exist in previous month. For 1/4/2024 ~ 4/4/2024, you want to fix their week start date to which date? 1/4/2024 or some other date?

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

 

Ritaf1983
Super User
Super User

Hi @ShibuyaSoo 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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