Forum Discussion

MHTANK's avatar
MHTANK
Helper III
1 year ago
Solved

Power bi matrix

 this is product sale data

 This is result I want.

I want last 15 days from today sales pieces,  average days and total value and that also for last 1 month and last 2 month in same matrix visual.

Please suggest me how to solve this?

Thanks 

  • Anonymous's avatar
    Anonymous
    1 year ago

    HI MHTANK ,

    What do you mean by import file in power bi?

     

    The sample data on my side has a Date type column named Date, not sure how you configure your data.

     

    Best Regards,
    Qi
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

     

     

6 Replies

  • We want to help you but your description is too vague. Please write it again clearly.

    Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

    Remove any unneeded columns which may cause confusion.

    Rename columns to user friendly names. Avoid your business or system jargon that we may not understand.
     
    Also provide the example desired output, with a clear step-by-step description of calculations the process flow.

    For example from when is 15 days, 1 month and 2 months derived?  Is it the most recent date on the table or the system date?

     

    How is the 3, 27 and 1005 caculated?

     

    Give a clear step by step description. Do not post Excel or DAX formulas. Just describe it is plain language. Thank you.

    Remember not to share private data ... we don't want you to get into trouble. ‌‌
    Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
    Try keep it simple and ask one question per ticket.
    You will get a quick response if you put time, care and effort into writing clear problem descriptions with example data.

    Look forward to helping you when the above information is forthcoming

     

     

    • MHTANK's avatar
      MHTANK
      Helper III

      3 is count of Ref No. ,27 is average of Days and 1005 is sum of value

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MHTANK

    I have made a simple demo for your reference.

     

    Write a measure and configure the Matrix as below:

    Measure = var _period=SELECTEDVALUE('Periods'[Periods])
    var _metics=SELECTEDVALUE('Metrics'[Metric])
    var _15ddays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)
    var _15dpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)
    var _15dvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)
    
    var _1mays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)
    var _1mpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)
    var _1mvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)
    
    var _2mays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
    var _2mpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
    var _2mvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
    return 
     if(_period="15 days",if(_metics="Days",_15ddays,if(_metics="Pcs",_15dpcs,if(_metics="Value",_15dvalues))),
     if(_period="1 month",if(_metics="Days",_1mays,if(_metics="Pcs",_1mpcs,if(_metics="Value",_1mvalues))),
      if(_period="2 month",if(_metics="Days",_2mays,if(_metics="Pcs",_2mpcs,if(_metics="Value",_2mvalues))))
     ))

    Best Regards,
    Qi
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    • MHTANK's avatar
      MHTANK
      Helper III
      1. When I am direct copy and paste data in power bi "Enter data" then this is work, but when I import file in power bi then this is not working
      • Anonymous's avatar
        Anonymous
        Not applicable

        HI MHTANK ,

        What do you mean by import file in power bi?

         

        The sample data on my side has a Date type column named Date, not sure how you configure your data.

         

        Best Regards,
        Qi
        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
        If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!