Forum Discussion

mejiaks's avatar
mejiaks
Frequent Visitor
8 years ago
Solved

Trend line chart

HI

 

I have a dataset with several rows showing 1 order per row

 

I need to show a chart showing Total orders per week, something like this

I have a measure that counts the orders on  a selected week, but when i try to ue it on the chart, it shows the wrong data

 

Orders Week = CALCULATE(DISTINCTCOUNT(TruckingData[OrderNO]),FILTER(TruckingData,TruckingData[RevType] <> "EREPO" && WEEKNUM(TruckingData[Book Date])=TruckingData[Current Week]))+ 0

 

what am i doing wrong?

  • mejiaks

    Try to create a calendar table

     

    Then link your table with this calendar table.

     

    Then remove one filter in your measure.

    Orders Week =
    CALCULATE (
        DISTINCTCOUNT ( TruckingData[OrderNO] ),
        FILTER (
            TruckingData,
            TruckingData[RevType] <> "EREPO"
                
        )
    )
        + 0
    

    In the line chart, put the 'Dimdate'[weeoNo] as axis and the measure as value. 

2 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Icon for Microsoft Employee rankMicrosoft Employee

    mejiaks

    Try to create a calendar table

     

    Then link your table with this calendar table.

     

    Then remove one filter in your measure.

    Orders Week =
    CALCULATE (
        DISTINCTCOUNT ( TruckingData[OrderNO] ),
        FILTER (
            TruckingData,
            TruckingData[RevType] <> "EREPO"
                
        )
    )
        + 0
    

    In the line chart, put the 'Dimdate'[weeoNo] as axis and the measure as value. 

    • mejiaks's avatar
      mejiaks
      Frequent Visitor

      Tnx Eric_Zhang

       

      Your solution works. I implemented my own though

       

      I created a Calculated Column

       

      Week 2 = WEEKNUM(TruckingData[Book Date]) 

       

      and I did this with the chart

       

       

      it displays the data as it should