Forum Discussion

szmaya's avatar
szmaya
New Member
1 year ago
Solved

Power BI measure Total issue

Hi everyone,
I need help creating a measure in power bi for a matrix table that's categorized by brand and store. It has three columns the first one contatins the number of found products in the store, the second one the required number for each brand and the third is the measure i'm trying to create. 

This how my current measure looks like:

Teljesülés = IF([Cikkek száma]<>BLANK(),IF(CALCULATE([Cikkek száma],FILTER('FACT_Jelenlét Márka','FACT_Jelenlét Márka'[Márka]=SELECTEDVALUE('FACT_Elvárt jelenlét'[Márka])))>=CALCULATE([SUM_Elvárt jelenlét],FILTER('FACT_Jelenlét Márka','FACT_Jelenlét Márka'[Márka]=SELECTEDVALUE('FACT_Elvárt jelenlét'[Márka]))),
1,
0
),
BLANK())


For the total row i would want it to sum the 1s from their rows , this way i could easily see how many stores met the required quantities per brand.

 

This is how my table currently looks like and how it should.

Thanks so much in advance!

  • Thank you both!
    This was the correct answer at the end:

    Teljesülés =
    SUMX (
    SUMMARIZE('FACT_Jelenlét','DIM_Bolttörzs'[Bolt kód], 'FACT_Jelenlét Márka'[Márka] ),
    VAR Found =  [Cikkek száma]
    VAR Required = [SUM_Elvárt jelenlét]
    RETURN
    IF (
    NOT ISBLANK ( Found ) && Found >= Required,
    1, 0 )
    )

3 Replies

  • Shahid12523's avatar
    Shahid12523
    Icon for Community Champion rankCommunity Champion

    use this

    Teljesülés =
    SUMX (
    VALUES ( 'FACT_Jelenlét Márka'[Bolt kód] ),
    VAR Found = CALCULATE ( [Cikkek száma] )
    VAR Required = CALCULATE ( [SUM_Elvárt jelenlét] )
    RETURN
    IF (
    NOT ISBLANK ( Found ) && Found >= Required,
    1,
    0
    )
    )

  • Hi szmaya, Hope you are doing good!

    Please try the below measure:

    Teljesülés =
    SUMX (
    VALUES ( 'FACT_Jelenlét Márka'[Store] ),
    VAR Found = [Cikkek száma]
    VAR Required = [SUM_Elvárt jelenlét]
    RETURN
    IF ( NOT ISBLANK ( Found ) && Found >= Required, 1, 0 )
    )


    If this post helps to answer your question, please consider accepting it as a solution so others can find it more quickly when they face a similar challenge.




    Proud to be a Microsoft Fabric community super user




    Let's Connect on LinkedIn




    Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.

     

  • Thank you both!
    This was the correct answer at the end:

    Teljesülés =
    SUMX (
    SUMMARIZE('FACT_Jelenlét','DIM_Bolttörzs'[Bolt kód], 'FACT_Jelenlét Márka'[Márka] ),
    VAR Found =  [Cikkek száma]
    VAR Required = [SUM_Elvárt jelenlét]
    RETURN
    IF (
    NOT ISBLANK ( Found ) && Found >= Required,
    1, 0 )
    )