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
diddlmus
Frequent Visitor

Time Intellegence - Compare day of week in Matrix

Hi All

 

Im trying to figure out how the heck to get a Matrix to show this months sales pr. day comparing to last years sales on the same day of week.

 

I have all my sales figures in a table and a master calender table.

 

I would like to have a column showing this months date and then the sales for this year and previous year pr. day.

What measure to write to do that.

 

COLUMN: DATE (Days)

COLUMN this year sale

COLUMN last year sale

ROWS: This Months Full Date

 

Is it even possible to do?

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

HI diddlmus,

 

Do you mean both this year sale and last year sale are measures? Where shall we put COLUMN: DATE (Days) and ROWS: This Months Full Date in matrix?

 

Assume in matrix this year sale and last year sale are measures which are placed in matrix visual Values bucket, and in Rows bucket put DATE column. You can use DAX formula below:

DATE =
DATESBETWEEN (
    EOMONTH ( EDATE ( TODAY (), -1 ), 0 )
        + 1,
    EOMONTH ( TODAY (), 0 ),
    DAY
)

 

this year sale =
VAR start_date =
    DATE ( YEAR ( TODAY () ), 1, 1 )
VAR end_date =
    DATE ( YEAR ( TODAY () ), 12, 31 )
RETURN
    CALCULATE ( MAX ( Sales[Sales] ), DATESBETWEEN ( start_date, end_date, day ) )

 

last year sale =
VAR start_date =
    DATE ( YEAR ( TODAY () ) - 1, 1, 1 )
VAR end_date =
    DATE ( YEAR ( TODAY () ) - 1, 12, 31 )
RETURN
    CALCULATE ( MAX ( Sales[Sales] ), DATESBETWEEN ( start_date, end_date, day ) )

 

If above DAX doesn’t work, please share some sample data and clarify desired results.

 

Regards,

Jimmy Tao

SivaMani
Resident Rockstar
Resident Rockstar

@diddlmus,

 

Could you please share sample data with the expected result?

@SivaMani

 
I hope this shows what i mean to do. 
 

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.