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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jlarques
Helper V
Helper V

Future expenses project

Dear community,

I have many rows with start and finish dates. I want to project expenses(cost+salary) for future months. For instance, we are in november and I want to project expenses for december. The question is that I don't want to include any employee that its end date is less than 31/12/2024, becuse this date means that the employee not finish its relationship with the company.

jlarques_1-1732852282064.png

I tried to create this measure, but the result is blank.

jlarques_2-1732852395316.png

How can I do this? 

Thanks to everybody.

 

José Luis 

 

 

1 ACCEPTED SOLUTION
FarhanJeelani
Super User
Super User

Hi @jlarques ,

To project expenses for a future month (e.g., December 2024) while excluding employees whose END DATE is earlier than 31/12/2024, you can modify your DAX measure as follows:

Corrected DAX Measure

ProjectedExpenses =
VAR _FechaFin = DATEVALUE("31/12/" & YEAR(TODAY()))
VAR Result =
    CALCULATE(
        SUM(factPuestos[Cost]) + SUM(factPuestos[Salary]),
        FILTER(
            factPuestos,
            factPuestos[END DATE] >= _FechaFin
        )
    )
RETURN
    Result

Explanation:

  1. _FechaFin Calculation:

    • Defines 31/12/2024 dynamically using the current year. Replace YEAR(TODAY()) with a specific year if necessary.
  2. FILTER Logic:

    • Ensures rows are included only if the END DATE is greater than or equal to 31/12/2024.
  3. Summation:

    • Adds the Cost and Salary columns for the filtered rows.
  4. SUM vs. VALUES:

    • Use SUM instead of VALUES to calculate total expenses, as VALUES will return a single value or an error for multiple rows.

Troubleshooting:

  • Ensure factPuestos[END DATE] is in a proper date format. If it is stored as text, convert it using DATEVALUE.
  • If the measure still returns blank, verify that:
    • There are rows where END DATE >= 31/12/2024.
    • Cost and Salary columns contain numeric values.

Let me know if you face further issues!

 

Please accept this as solution if it helps. Appreciate Kudos.

View solution in original post

2 REPLIES 2
jlarques
Helper V
Helper V

Thank you so much @FarhanJeelani !

your explanation contains important details to understand what was the problem. Now it works and I have my specific calculation for each employee.

 

Thanks again!

 

 

FarhanJeelani
Super User
Super User

Hi @jlarques ,

To project expenses for a future month (e.g., December 2024) while excluding employees whose END DATE is earlier than 31/12/2024, you can modify your DAX measure as follows:

Corrected DAX Measure

ProjectedExpenses =
VAR _FechaFin = DATEVALUE("31/12/" & YEAR(TODAY()))
VAR Result =
    CALCULATE(
        SUM(factPuestos[Cost]) + SUM(factPuestos[Salary]),
        FILTER(
            factPuestos,
            factPuestos[END DATE] >= _FechaFin
        )
    )
RETURN
    Result

Explanation:

  1. _FechaFin Calculation:

    • Defines 31/12/2024 dynamically using the current year. Replace YEAR(TODAY()) with a specific year if necessary.
  2. FILTER Logic:

    • Ensures rows are included only if the END DATE is greater than or equal to 31/12/2024.
  3. Summation:

    • Adds the Cost and Salary columns for the filtered rows.
  4. SUM vs. VALUES:

    • Use SUM instead of VALUES to calculate total expenses, as VALUES will return a single value or an error for multiple rows.

Troubleshooting:

  • Ensure factPuestos[END DATE] is in a proper date format. If it is stored as text, convert it using DATEVALUE.
  • If the measure still returns blank, verify that:
    • There are rows where END DATE >= 31/12/2024.
    • Cost and Salary columns contain numeric values.

Let me know if you face further issues!

 

Please accept this as solution if it helps. Appreciate Kudos.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.