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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filters & DAX

Hello dear community, how are you?

I have this case:

 

I need 3 DAX measurements that calculate the following for me:

 

  1. I want to calculate the Total Forecast3 2021.
  2. I want to calculate the Total Budget 2022.
  3. And another formula that calculates the difference between Forecast3 2021 vs Budget 2022 (Budget 2022 - Forecast3 2021).

The table contains these 3 columns that are necessary for the calculation:

 

  1. Report Date "Fecha Reporte": This covers all the months of 2020, 2021, 2022.
  2.  USD Amount "Monto USD": This is the column that contains the value of the amount.
  3. Opex type "Tipo Opex": This contains the budget classifications or segmentations (Actual, Budget, Forecast1, Forecast2, Forecast3).

TableTable

Also bear in mind that I already have a Total measure for each Budget and Forecasts segment.

Reyesnes_0-1628601999098.png

I even leave the PBIX to you so that you can help me directly with it. I am very urgent and I will be eternally grateful to whoever helps me. Download pbix

 

 

@Greg_Deckler @CNENFRNL @Anonymous @amitchandak 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

the following measures should do that.

For your case 1:

Forecast3 2021 = 
CALCULATE(
    SUM( 'Fact_ Budget Management'[Monto USD] ),
    'Fact_ Budget Management'[Tipo Opex] = "Forecast3",
    YEAR( 'Fact_ Budget Management'[Fecha Reporte] ) = 2021
)

 

Case 2:

Total Budget 2022 = 
CALCULATE(
    SUM( 'Fact_ Budget Management'[Monto USD] ),
    'Fact_ Budget Management'[Tipo Opex] = "Budget",
    YEAR( 'Fact_ Budget Management'[Fecha Reporte] ) = 2022
)

 

And case 3:

Difference Forecast3 2021 vs Budget 2022 = [Forecast3 2021] - [Total Budget 2022]

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

3 REPLIES 3
selimovd
Super User
Super User

Hey @Anonymous ,

 

the following measures should do that.

For your case 1:

Forecast3 2021 = 
CALCULATE(
    SUM( 'Fact_ Budget Management'[Monto USD] ),
    'Fact_ Budget Management'[Tipo Opex] = "Forecast3",
    YEAR( 'Fact_ Budget Management'[Fecha Reporte] ) = 2021
)

 

Case 2:

Total Budget 2022 = 
CALCULATE(
    SUM( 'Fact_ Budget Management'[Monto USD] ),
    'Fact_ Budget Management'[Tipo Opex] = "Budget",
    YEAR( 'Fact_ Budget Management'[Fecha Reporte] ) = 2022
)

 

And case 3:

Difference Forecast3 2021 vs Budget 2022 = [Forecast3 2021] - [Total Budget 2022]

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

@selimovd Thank you very much, it is exactly what I needed.

Anonymous
Not applicable

Hi @Anonymous 

 

By hard-coding the names of the years, you're shooting yourself in the foot. You'll suffer later.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.