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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
carolinesbp_
Regular Visitor

Calculate the 6-month proportional targetcalculate

Hi guys,

I have calculated the proportional target up to the day before today, but I would like to calculate this proportional target for 6 months, up to June.

is a calculated column

MetaProporcional =
                    var dia = SUMx(FILTER('Calendário', and(and('Calendário'[Data]>='01. Meta'[Primeiro dia], 'Calendário'[Data] <= '01. Meta'[Ultimo dia]), and('Calendário'[mês] = '01. Meta'[Mês],'Calendário'[ano] = '01. Meta'[Ano]))),'Calendário'[DIaUtil])

                   var metaproporcional = DIVIDE('01. Meta'[Meta],dia)* SUMx(FILTER('Calendário', and(and('Calendário'[Data]>='01. Meta'[Primeiro dia], 'Calendário'[Data] <= TODAY()-1), and('Calendário'[mês] = '01. Meta'[Mês],'Calendário'[ano] = '01. Meta'[Ano]))),'Calendário'[DIaUtil])

            RETURN metaproporcional
by selecting the months from January to June in the filter this is my proposed goal:
 
3.JPG
I would like to add to this dax so that it only adds the months from January to June, without me having to filter out the 6 months in the filter.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @carolinesbp_ 

You can try the following code.

MetaProporcional =
VAR dia =
    SUMX (
        FILTER (
            'Calendário',
            'Calendário'[Data] >= '01. Meta'[Primeiro dia]
                && 'Calendário'[Data] <= '01. Meta'[Ultimo dia]
                && 'Calendário'[mês] = '01. Meta'[Mês]
                && 'Calendário'[ano] = '01. Meta'[Ano]
                && 'Calendário'[mês] >= 1
                && 'Calendário'[mês] <= 6
        ),
        'Calendário'[DIaUtil]
    )
VAR metaproporcional =
    DIVIDE ( '01. Meta'[Meta], dia )
        * SUMX (
            FILTER (
                'Calendário',
                'Calendário'[Data] >= '01. Meta'[Primeiro dia]
                    && 'Calendário'[Data]
                        <= TODAY () - 1
                    && 'Calendário'[mês] = '01. Meta'[Mês]
                    && 'Calendário'[ano] = '01. Meta'[Ano]
                    && 'Calendário'[mês] >= 1
                    && 'Calendário'[mês] <= 6
            ),
            'Calendário'[DIaUtil]
        )
RETURN
    metaproporcional

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @carolinesbp_ 

You can try the following code.

MetaProporcional =
VAR dia =
    SUMX (
        FILTER (
            'Calendário',
            'Calendário'[Data] >= '01. Meta'[Primeiro dia]
                && 'Calendário'[Data] <= '01. Meta'[Ultimo dia]
                && 'Calendário'[mês] = '01. Meta'[Mês]
                && 'Calendário'[ano] = '01. Meta'[Ano]
                && 'Calendário'[mês] >= 1
                && 'Calendário'[mês] <= 6
        ),
        'Calendário'[DIaUtil]
    )
VAR metaproporcional =
    DIVIDE ( '01. Meta'[Meta], dia )
        * SUMX (
            FILTER (
                'Calendário',
                'Calendário'[Data] >= '01. Meta'[Primeiro dia]
                    && 'Calendário'[Data]
                        <= TODAY () - 1
                    && 'Calendário'[mês] = '01. Meta'[Mês]
                    && 'Calendário'[ano] = '01. Meta'[Ano]
                    && 'Calendário'[mês] >= 1
                    && 'Calendário'[mês] <= 6
            ),
            'Calendário'[DIaUtil]
        )
RETURN
    metaproporcional

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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