Forum Discussion
Repeating Records of table
- 2 years ago
To achieve this in Power BI, you can use DAX (Data Analysis Expressions) to create calculated columns and measures that will help you forecast the headcount (HC) for the rest of the year based on the most recent month's data.
Step 1: Load the Data
- Open Power BI Desktop.
- Click on "Get Data" and import your Excel file.
- Load the data into Power BI.
Step 2: Create Measures for Forecasting
You can create DAX measures to forecast the HC for future months based on the latest available data. Here's a step-by-step guide:
- Identify the Most Recent Month:
- Create a measure to get the most recent month with available data.
- dax formula =LatestMonth = MAX('EmployeeHC'[Month])
- Get the HC for the Most Recent Month:
- Create a measure to get the HC value for the most recent month.
- dax formula below
- HC_LatestMonth =
CALCULATE(
MAX('EmployeeHC'[HC]),
FILTER(
'EmployeeHC',
'EmployeeHC'[Month] = [LatestMonth]
)
)
- Forecast HC for Future Months:
- Create a measure to use the latest month’s HC value for future months.
- dax expression below
- ForecastedHC =
VAR CurrentMonth = MAX('DateTable'[MonthYear])
VAR LatestMonthWithData = MAX('EmployeeHC'[Month])
RETURN
IF(
FORMAT(CurrentMonth, "YYYY-MM") <= FORMAT(LatestMonthWithData, "YYYY-MM"),
CALCULATE(MAX('EmployeeHC'[HC]), 'EmployeeHC'[Month] = CurrentMonth),
CALCULATE(MAX('EmployeeHC'[HC]), 'EmployeeHC'[Month] = LatestMonthWithData)
)
Step 3: Create a Table for Forecasted HC
- Create a Date Table:
- Go to Modeling > New Table and create a Date table if you don’t already have one.
- dax expression below
- DateTable =
CALENDAR(
DATE(YEAR(TODAY()), 1, 1),
DATE(YEAR(TODAY()), 12, 31)
)
Create Relationships:
- Create a relationship between your own table and the DateTable based on the Month column.
Visualize the Data:
- Create a table or matrix visual and use the Month column from the DateTable and the ForecastedHC measure to display the forecasted HC values.
Anonymous just follow this steps and it will work.
Please accept this as a soultion once are done with it.
Here you... Left side is the data table in PBI, Right 3 columns are how the dat should look like. For the month when I update the data, it should consider same count for the rest of the financial year
Anonymous
Above is the output I have done with sample data in power BI. is this way you are looking for?
IF so I can share the screenshot of it how I did it.
- Anonymous2 years agoNot applicable
Yes Jaytam .. This is what I am looking at
- Jaytam2 years agoFrequent Visitor
To achieve this in Power BI, you can use DAX (Data Analysis Expressions) to create calculated columns and measures that will help you forecast the headcount (HC) for the rest of the year based on the most recent month's data.
Step 1: Load the Data
- Open Power BI Desktop.
- Click on "Get Data" and import your Excel file.
- Load the data into Power BI.
Step 2: Create Measures for Forecasting
You can create DAX measures to forecast the HC for future months based on the latest available data. Here's a step-by-step guide:
- Identify the Most Recent Month:
- Create a measure to get the most recent month with available data.
- dax formula =LatestMonth = MAX('EmployeeHC'[Month])
- Get the HC for the Most Recent Month:
- Create a measure to get the HC value for the most recent month.
- dax formula below
- HC_LatestMonth =
CALCULATE(
MAX('EmployeeHC'[HC]),
FILTER(
'EmployeeHC',
'EmployeeHC'[Month] = [LatestMonth]
)
)
- Forecast HC for Future Months:
- Create a measure to use the latest month’s HC value for future months.
- dax expression below
- ForecastedHC =
VAR CurrentMonth = MAX('DateTable'[MonthYear])
VAR LatestMonthWithData = MAX('EmployeeHC'[Month])
RETURN
IF(
FORMAT(CurrentMonth, "YYYY-MM") <= FORMAT(LatestMonthWithData, "YYYY-MM"),
CALCULATE(MAX('EmployeeHC'[HC]), 'EmployeeHC'[Month] = CurrentMonth),
CALCULATE(MAX('EmployeeHC'[HC]), 'EmployeeHC'[Month] = LatestMonthWithData)
)
Step 3: Create a Table for Forecasted HC
- Create a Date Table:
- Go to Modeling > New Table and create a Date table if you don’t already have one.
- dax expression below
- DateTable =
CALENDAR(
DATE(YEAR(TODAY()), 1, 1),
DATE(YEAR(TODAY()), 12, 31)
)
Create Relationships:
- Create a relationship between your own table and the DateTable based on the Month column.
Visualize the Data:
- Create a table or matrix visual and use the Month column from the DateTable and the ForecastedHC measure to display the forecasted HC values.
Anonymous just follow this steps and it will work.
Please accept this as a soultion once are done with it.