Forum Discussion

RikMertens's avatar
RikMertens
Frequent Visitor
8 years ago
Solved

Visual on 2 different dates in 1 single row

Hi Guys,

 

Below a simplified representation of the data i have. I have a long list of documents which have an 'opening date' and a 'closing' date. I want to have a chart showing me how many documents were open and closed in a specific month. I can't gat power BI to do this (tough it seems pretty straight forward).

 

I created a data table to be able to show the last 12 monts and tried to relate boths dates (opened / closed) to it.

 

The issue i'm having is that a document which is closed in feb for ex. but started in jan is still counted as 'closed' in jan.

 

 

  • iamprajot's avatar
    iamprajot
    8 years ago

    Here it is,

    Create 2 Measures

    Closed within Same Month = CALCULATE(COUNT(Data[DOC NR]),FILTER(Data,Data[DATE CLOSED]<=EOMONTH(Data[DATE OPEN],0)))

    Open within Same Month = CALCULATE(COUNT(Data[DOC NR]),FILTER(Data,Data[DATE CLOSED]>EOMONTH(Data[DATE OPENED],0)))

     

     

     

3 Replies

  • jthomson's avatar
    jthomson
    Icon for Solution Sage rankSolution Sage

    It's probably a relationship issue - let's assume that the opened date is the one that has the active relationship to your date table, when you're wanting to count the number of closed dates, in your measure to do so you need to add in userelationship to tell Power BI to look at the relationship between your date table and your closed date column

    • RikMertens's avatar
      RikMertens
      Frequent Visitor

      I was thinking the same way. I am hower not that familliar yet with measures which count rows. Is there any working example available somewhere?

      • iamprajot's avatar
        iamprajot
        Icon for Responsive Resident rankResponsive Resident

        Here it is,

        Create 2 Measures

        Closed within Same Month = CALCULATE(COUNT(Data[DOC NR]),FILTER(Data,Data[DATE CLOSED]<=EOMONTH(Data[DATE OPEN],0)))

        Open within Same Month = CALCULATE(COUNT(Data[DOC NR]),FILTER(Data,Data[DATE CLOSED]>EOMONTH(Data[DATE OPENED],0)))