Forum Discussion

bajimmy1983's avatar
bajimmy1983
Icon for Advocate V rankAdvocate V
9 years ago
Solved

Cumulative Sales only by Selected Year

Hi all,   I am using power pivot with all relationships created and OK. There is one Dim Table called "date" and another Transaction Table called "pipe".   In "date" table there is a column with ...
  • bajimmy1983's avatar
    bajimmy1983
    9 years ago

    Hi all.

     

    I think I found a solution regarding to my last reply. Talking to my wife today about it (and Yeah, she does not know anything about DAX) she helped me to figure out a way using a different approach of IF statement. Funny! At least it is working.

     

    I know that you may have a lot of other ways to reach same outcome and I kindly ask you to share with us. Regardless this issue is a very basic one I think it is important to know about other ways and of course I am learning a lot with Power BI Community.

     

    My New Calculated Field

     

    ACT. Y. BIL. BRL :=
    IF (
        OR (
            CALCULATE ( [ACT. BIL. BRL]; FILTER ( 'date'; 'date'[Month Number] ) ) = 0;
            CALCULATE ( [ACT. BIL. BRL]; FILTER ( 'date'; 'date'[Month Number] ) )
                = BLANK ()
        );
        BLANK ();
        CALCULATE (
            [ACT. BIL. BRL];
            FILTER (
                ALL ( 'date' );
                'date'[Year] = MAX ( 'date'[Year] )
                    && 'date'[Date] <= MAX ( 'date'[Date] )
            )
        )
    )

    Thanks again,