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
sid-poly
Helper I
Helper I

Drill Down on Date Field Parameters

There is a field Parameter that I have used and it has multiple Date Columns, I have a few issues with it

1. When I select the Parameter, It gives me the date, but when I change it, it doesn't give me another date but some random numerical values

2. I want to drill down the field date parameter to Month, Week, and Day how do I do it with SWITCH? I have created multiple columns of Week calculation for the different date field parameters, can anyone suggest another workaround for the same?

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

1. Random Numerical Values Issue:

When you select a date from a parameter and see random numerical values instead of another date, it could be due to various reasons like data type mismatch or incorrect calculation. Here are a few steps to troubleshoot:

  • Check Data Types: Ensure that the data types of your date columns match with the data type expected by the parameter.
  • Parameter Configuration: Double-check your parameter configuration. Ensure that it is set up to accept dates and is correctly linked to the date columns in your dataset.
  • Check Calculations: Ensure that there are no conflicting calculations or transformations applied to the date fields that could be causing the unexpected behavior.

2. Drill Down to Month, Week, and Day:

To drill down the field date parameter to Month, Week, and Day in Power BI, you can create separate calculated columns or measures using DAX functions. Here's how you can achieve this:

Using DAX SWITCH Function:

You can use the SWITCH function to create calculated columns for Month, Week, and Day. Here's an example:

 

MonthColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), FORMAT([YourDateField], "MMMM")
)

WeekColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), "Week " & FORMAT(WEEKNUM([YourDateField]), "0")
)

DayColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), FORMAT([YourDateField], "DD-MMM-YYYY")
)

 

Replace [YourDateField] with your actual date field name.

Workaround for Multiple Date Fields:

If you have multiple date fields and want to create week calculations for each of them, you can create separate calculated columns or measures for each date field using DAX functions like WEEKNUM to extract the week number.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

1. Random Numerical Values Issue:

When you select a date from a parameter and see random numerical values instead of another date, it could be due to various reasons like data type mismatch or incorrect calculation. Here are a few steps to troubleshoot:

  • Check Data Types: Ensure that the data types of your date columns match with the data type expected by the parameter.
  • Parameter Configuration: Double-check your parameter configuration. Ensure that it is set up to accept dates and is correctly linked to the date columns in your dataset.
  • Check Calculations: Ensure that there are no conflicting calculations or transformations applied to the date fields that could be causing the unexpected behavior.

2. Drill Down to Month, Week, and Day:

To drill down the field date parameter to Month, Week, and Day in Power BI, you can create separate calculated columns or measures using DAX functions. Here's how you can achieve this:

Using DAX SWITCH Function:

You can use the SWITCH function to create calculated columns for Month, Week, and Day. Here's an example:

 

MonthColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), FORMAT([YourDateField], "MMMM")
)

WeekColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), "Week " & FORMAT(WEEKNUM([YourDateField]), "0")
)

DayColumn =
SWITCH(
TRUE(),
ISBLANK([YourDateField]), BLANK(),
TRUE(), FORMAT([YourDateField], "DD-MMM-YYYY")
)

 

Replace [YourDateField] with your actual date field name.

Workaround for Multiple Date Fields:

If you have multiple date fields and want to create week calculations for each of them, you can create separate calculated columns or measures for each date field using DAX functions like WEEKNUM to extract the week number.

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.

Top Kudoed Authors