Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Common date axis

Hi guys,

 

I am working on a consignment report. One of the data set is as below. I wish to see a simple graph containing No. of goods issued, invoiced and returned in each month.

I created a date table and linked it to the dates mentioned above. However, only one relationship can be active right and that's goods issue at the moment.

 

Now when I plot Date on x axis against goods issue date, invoice date, return date on Y axis, I get correct GI date entries and corresponding invoice date, return date entries. I kind of understand why this is happening but not able to figure out  how do I get, no. of invoices, returns in every month regardless when they were issued.

 

Any help would be much appreciated. Thanks!

 

Regards,

Shaheen

shaheen_taori_0-1593673828364.png

 
 

PBI_query_1.jpg

PBI_query_2.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
 

 

 

 

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a date table but don't create a relationship between date table and your table.

Date = ADDCOLUMNS(CALENDARAUTO(),"year-month",FORMAT([Date],"YYYY Mmm"),"y-m",FORMAT([Date],"yyyy-mm"))

add columns
start_month = STARTOFMONTH('Date'[Date])
end_month = ENDOFMONTH('Date'[Date])

Create measures

good_issue =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Good Issue Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Good Issue Date] <= MAX ( 'Date'[end_month] )
    )
)

invoice =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Invoice Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Invoice Date] <= MAX ( 'Date'[end_month] )
    )
)


return =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Return Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Return Date] <= MAX ( 'Date'[end_month] )
    )
)

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a date table but don't create a relationship between date table and your table.

Date = ADDCOLUMNS(CALENDARAUTO(),"year-month",FORMAT([Date],"YYYY Mmm"),"y-m",FORMAT([Date],"yyyy-mm"))

add columns
start_month = STARTOFMONTH('Date'[Date])
end_month = ENDOFMONTH('Date'[Date])

Create measures

good_issue =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Good Issue Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Good Issue Date] <= MAX ( 'Date'[end_month] )
    )
)

invoice =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Invoice Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Invoice Date] <= MAX ( 'Date'[end_month] )
    )
)


return =
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Return Date] >= MIN ( 'Date'[start_month] )
            && 'Table'[Return Date] <= MAX ( 'Date'[end_month] )
    )
)

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , So if date table and Join it multiple dates only one is active. So it will only run on an active date. So if the invoice date is active all data is by active date.

 

So if we want to change the date we need to use userelation . So that invoices run by invoice date, the issue will run by issue date.

 

Refer to this example how to use

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.