If I have a column with Year and column with Month. How to determine the starting day of…
- User
If I have a column with Year and column with Month. How to determine the starting day of Month and Year using DAX?
- Assistant
To determine the starting day of a month and year using DAX, you can create a calculated column in Power BI or Power Pivot using the following formula:
codeStarting Day = DATE([Year], [Month], 1)Assuming you have a column named "Year" containing the year values, and another column named "Month" containing the month values, this formula will create a new calculated column named "Starting Day" which will give you the starting day of each month and year combination.
- User
How to determine the ending day of Month and Year using DAX?
- Assistant
To determine the ending day of a month and year using DAX, you can create a calculated column in Power BI or Power Pivot using the following formula:
codeEnding Day = DATEADD(DATEADD(DATE([Year], [Month], 1), 1, MONTH), -1, DAY)This formula adds one month to the first day of the specified month and year, and then subtracts one day to get the last day of that month. Assume you have a column named "Year" containing the year values, and another column named "Month" containing the month values. This formula will create a new calculated column named "Ending Day" which will give you the ending day of each month and year combination.
- User
Ending Day = DATEADD(DATEADD(DATE('Share_SKU_Month'[Year], 'Share_SKU_Month'[Month], 1), 1, MONTH), -1, DAY) Fix the error A table expression containing more than one column was specified in the call to function 'DATEADD'. This is not supported.
- Assistant
I'm sorry for the confusion. It looks like you are trying to use a table expression instead of a single column in the DATEADD function. To resolve this error, you need to convert the Year and Month columns into a single date column for the DATEADD function to work correctly.
You can achieve this by creating a new calculated column in Power BI or Power Pivot using the following formula:
codeEnding Day = DATEADD(DATE([Year], [Month], 1), 1, MONTH) - 1Assuming you have a column named "Year" containing the year values, and another column named "Month" containing the month values, this formula will create a new calculated column named "Ending Day" which will give you the ending day of each month and year combination.
- User
Why the DAX for calculated column return blank rows Ending Day of Month = DATEADD('Share_SKU_Month'[Starting Day of Month],1,MONTH)
- Assistant
If the DAX formula for the calculated column "Ending Day of Month" is returning blank rows, it could be due to missing or null values in the column "Starting Day of Month" or an incorrect reference to the column.
To troubleshoot and resolve this issue, you can try the following steps:
-
Confirm that the column "Starting Day of Month" has the correct values and does not contain any null or missing values. You can check this by creating a table visual and verifying the values in that column.
-
Verify that the column "Starting Day of Month" is referenced correctly in the DAX formula. Make sure the column name is spelled correctly and has the correct table name preceded with the appropriate '[]' notation.
-
In case your column "Starting Day of Month" does contain null or missing values, and you want the formula to return blank for those rows, you can modify the formula by adding an additional conversion step to handle those situations, using the IF function. Here's an example:
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.