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
cdbhealy
New Member

Date format

I have a data table that has transactions for a retail business. I am wanting to make a line chart which has each year as a separate line, and then the month/day as the horizontal axis with quantity sold as the vertical axis. Ultimately I would like the line to be a running total as of the date on the horizontal axis the quantity sold year to date.  

 

transactions.JPG

 

The first problem I am having is with getting just the month-day. I was able to separate out the year from the 'SaleDay' but any time I try to just get the month-day separate I keep getting errors. I am using DirectQuery to an sql database so as the database updates the chart will update as well. So some solutions I have found on the forum have not worked because it says it is not supported by directquery.

 

Chart.JPG

If anyone has a suggestion for also get a running total (the quick measure way didn't work for me, maybe I did wrong fields) I would be very appreciative. 

1 ACCEPTED SOLUTION
vik0810
Resolver V
Resolver V

Do You have predefined values for years? If so, you can create a measure for given years current total and place them on your chart.

A measure definition could be like that:

 

2016 = CALCULATE (
    [your measure],
    FILTER (
        ALL ( Table[SaleDay] ),
        MONTH(Table[SaleDay]) <= MAX ( MONTH(Table[SaleDay]) )
            && YEAR ( Table[SaleDay] ) = 2016
    )
)

and your result would look like:

 

rt.png

View solution in original post

1 REPLY 1
vik0810
Resolver V
Resolver V

Do You have predefined values for years? If so, you can create a measure for given years current total and place them on your chart.

A measure definition could be like that:

 

2016 = CALCULATE (
    [your measure],
    FILTER (
        ALL ( Table[SaleDay] ),
        MONTH(Table[SaleDay]) <= MAX ( MONTH(Table[SaleDay]) )
            && YEAR ( Table[SaleDay] ) = 2016
    )
)

and your result would look like:

 

rt.png

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.