Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Power BI Dax help

Hello Community,

 

I am working on some analysis, which i have figured in excel, but need help with Power BI below is the table view

 

Top row is Month number

I want 93,400 value to appear in each month from 4 to 9, similar for row 3 from month 6 to 9 and down

 

I have created Calendar table for top row month

 

Current

Value123456789
93400   93,400     
5233     5233   
6588    6588    
          

 

Wanted to look

Value123456789
93400   934009340093400934009340093400

5266

     5266526652665266
6588    6588658865886588 6588

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to your description, here are my steps you can follow as a solution.

    (1)My test data is the same as yours.

    (2) We can create a measure. 

     

    Measure 2 = var a=MAXX(FILTER(ALLSELECTED('Table'),[Value] in VALUES('Table'[Value])&&[Result]<>BLANK()),[Date])
    var b=CALCULATE(SUM('Table'[Result]),FILTER('Table',EOMONTH('Table'[Date],0)=EOMONTH(MAX('CALENDAR'[Date]),0)))
    
    return IF(b<>BLANK(),b,IF(b=BLANK()&&MAX('CALENDAR'[Date])>a,CALCULATE(SUM('Table'[Result]),'Table'[Date]=a)))

     

    (3) Then the result is as follows.

     

    Best Regards,

    Neeko Tang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello,

       

      Please see below output based on formula you in the file. I try to do Joining Calendar table but result is same as current (in above pic)

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        Please create a calculated column in the calendar table.

        Month_num = MONTH('CALENDAR'[Date])

        Create this measure.

        Measure 2 = var a=MAXX(FILTER(ALLSELECTED('Table'),[Value] in VALUES('Table'[Value])&&[Result]<>BLANK()),[Date])
        var b=CALCULATE(SUM('Table'[Result]),FILTER('Table',EOMONTH('Table'[Date],0)=EOMONTH(MAX('CALENDAR'[Date]),0)))
        
        return IF(b<>BLANK(),b,IF(b=BLANK()&&MAX('CALENDAR'[Date])>a,CALCULATE(SUM('Table'[Result]),'Table'[Date]=a)))

        Note that the measure is 'CALENDAR'[Date] and not 'CALENDAR'[Date]. [Date]

         

        Places the new column of the calendar table on the columns of the matrix.

        Best Regards,

        Neeko Tang

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