cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marijane12 Regular Visitor
Regular Visitor

sum measure flag

Hi everybody,

 

I have a table that is grouped by  "Distribuidores" and "Anunciantes". The meausures of the table are "Facturado Current  Year" and "Facturado Last Year". I want to know the percent of "Anunciantes" that were lost and earned over the year. So, for the "Anunciantes " lost I need to calculate the "Anunciantes" that were in LY but they are not in the current year. And for the anunciantes earned I need to calculate the "Anunciantes" that are in the current year but not on the last year.

The table is below. I made a flag that is 1 when the "Anunciante" are in LY but aren't in the current year. For the "Anunciantes" earned I mad the opposite.

 

Flag_1 = IF(NOT(ISBLANK([Facturado LY]));IF([Facturado LY]>0 && ISBLANK([Facturado]);1))

Flag_2= IF(NOT(ISBLANK([Facturado]));IF([Facturado]>0 && isblank([Facturado LY]);1))

 

My idea is sum the flags and divide by the total of rows. The problem is that I can't sum up a meausure or I don't know how to do it. Can you help please?

I exported the table. Var is Flag_1 and var3 is Flag_2 https://drive.google.com/file/d/1866-h9C99vdXrYqyeSrLhnlFGZsXSG4n/view?usp=sharing

anuciantes_perdidos_ganhos.PNG

 

 

2 REPLIES 2
sturlaws Senior Member
Senior Member

Re: sum measure flag

Hi @marijane12 

will this code give you what you need?

percentage new =
DIVIDE (
    CALCULATE (
        DISTINCTCOUNT ( data[Anunciante] );
        FILTER (
            data;
            OR ( ISBLANK ( data[Facturado LY] ); data[Facturado LY] <= 0 )
                && NOT (
                    ISBLANK ( ( data[Facturado] ) )
                        && data[Facturado] > 0
                )
        )
    );
    CALCULATE (
        DISTINCTCOUNT ( data[Anunciante] );
        FILTER ( data; NOT ( ISBLANK ( data[Facturado] ) ) && data[Facturado] > 0 )
    )
)


I have reused some of the code you had put into the flags

Highlighted
marijane12 Regular Visitor
Regular Visitor

Re: sum measure flag

it wasn't exactly what I wanted but it helped! Thank tou! @sturlaws 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 200 members 2,024 guests
Please welcome our newest community members: