Forum Discussion

huguestremblay's avatar
5 years ago
Solved

Show dates with no data on chart

Hello,   I have read through countless posts and tried everithing I could think of but cannot get what I want.    I have a bar chart that shows data for the last 12 months, with the date on the x...
  • MFelix's avatar
    5 years ago

    Hi huguestremblay ,

     

    You issue with this is the FILTER measure that is giving you additional context to your measure and not returning the values for the months that are not selected.

     

    I have made the following measure based on your FILTER just changed 1 by COUNT ID:

     

    Filter__ = 
    IF (
        ISFILTERED ( 'Color'[Color] ) = FALSE;
        IF (
            ISFILTERED ( 'Template'[Template] ) = FALSE ();
            1;
            IF (
                MAX ( 'Table'[Template] ) = "";
                0;
                IF (
                    SEARCH (
                        MAX ( 'Table'[Template] );
                        CONCATENATEX ( 'Template'; [Template]; "," );
                        COUNT('Table'[ID]);
                        0
                    ) > 0;
                    COUNT('Table'[ID]);
                    0
                )
            )
        );
        IF (
            SELECTEDVALUE ( 'Table'[Template] ) = BLANK ();
            IF (
                MAX ( 'Table'[Color] ) = "";
                0;
                IF (
                    SEARCH ( MAX ( 'Table'[Color] ); CONCATENATEX ( 'Color'; [Color]; "," ); 1; 0 ) > 0;
                    COUNT('Table'[ID]);
                    0
                )
            );
            IF (
                MAX ( 'Table'[Color] ) = "";
                0;
                IF (
                    SEARCH ( MAX ( 'Table'[Color] ); CONCATENATEX ( 'Color'; [Color]; "," ); 1; 0 ) > 0;
                    COUNT('Table'[ID]);
                    IF (
                        MAX ( 'Table'[Template] ) = "";
                        0;
                        IF (
                            SEARCH (
                                MAX ( 'Table'[Template] );
                                CONCATENATEX ( 'Template'; [Template]; "," );
                                1;
                                0
                            ) > 0;
                            COUNT('Table'[ID]);
                            0
                        )
                    )
                )
            )
        )
    )

     

    Result is in attach PBIX file:

     

     

    I'm not really sure what you want to achieve with the FILTER measure but having so many nested IF is confusing believe you would be better off with a SWITCH function if can please explain the purpose of the FILTER I can change the syntax to SWITCH.