cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hubner
New Member

Calculate with slice

Hello!

 

Can someone help me? How can I use a metric by filtering the slice in expression calculate?

 

Exemple: 

 

SelectedSLICE = MIN('FatoMeta Budget MP e Horas'[idMes])

 

Meta Budget MP = CALCULATE(SUM('FatoMeta Budget MP e Horas'[Meta MP]);'FatoMeta Budget MP e Horas'[idMes]<[SelectedSLICE])/1000

 

 

1 ACCEPTED SOLUTION

Hi @Hubner,

 

So I think you need to add a filter statement into your calculate solution since you're referencing a DAX measure in the filter. I also like to think of DAX Measures as building blocks, since there is a good chance you'd want to reference the SUM of Meta MP in another formula, why not give that its own DAX Measure that other formulas can reference? So I'd do this in two steps.

 

First Formula:

[SUM of Meta MP] = SUM ( 'FatoMeta Budget MP e Horas'[Meta MP] )

 

Second Formula: 

Meta Budget MP =
CALCULATE (
    [SUM of Meta MP],
    FILTER ( 'FatoMeta Budget MP e Horas', [idMes] < [SelectedSLICE] )
)
    / 1000

By the way, if you ever want to easily format your DAX Formulas. DAX Formatter is a great website for that. 🙂

 

Best Regards,

Reid Havens - Owner | Founder

Havens Consulting Inc.

View solution in original post

1 REPLY 1

Hi @Hubner,

 

So I think you need to add a filter statement into your calculate solution since you're referencing a DAX measure in the filter. I also like to think of DAX Measures as building blocks, since there is a good chance you'd want to reference the SUM of Meta MP in another formula, why not give that its own DAX Measure that other formulas can reference? So I'd do this in two steps.

 

First Formula:

[SUM of Meta MP] = SUM ( 'FatoMeta Budget MP e Horas'[Meta MP] )

 

Second Formula: 

Meta Budget MP =
CALCULATE (
    [SUM of Meta MP],
    FILTER ( 'FatoMeta Budget MP e Horas', [idMes] < [SelectedSLICE] )
)
    / 1000

By the way, if you ever want to easily format your DAX Formulas. DAX Formatter is a great website for that. 🙂

 

Best Regards,

Reid Havens - Owner | Founder

Havens Consulting Inc.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.