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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MReinagl
Frequent Visitor

Showing last 7 days and monthly total in one matrix

Hi,

 

I have sales figures for different products per day and want to build a report showing:

- sales for each of the last seven days per product

- total sales for the current month per product

- average sales per day for the current week

 

I managed to create a measure which summarised the sales for the last seven days which is then shown in the matrix:

MReinagl_0-1619531442296.png

 

How can I now add the monthly total and maybe the average sales per day for the current week?

 

Thanks

Matthias

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

Hi @MReinagl 

Please correct me if I wrongly understood your question.

(1)We can achieve monthly total through the time hierarchy.

Original matrix visual

Ailsa-msft_0-1619687060501.png

Use time hierarchy function:

Ailsa-msft_1-1619687060504.png

Ailsa-msft_2-1619687060505.png

(2)Create a column to get the average sales per day for the current week .And then add the column in Vaules .

 average = CALCULATE(AVERAGE('Table'[Price]),FILTER('Table','Table'[Date]>MAX('Table'[Date])-7 && 'Table'[Date]<= MAX('Table'[Date])))

Ailsa-msft_3-1619687060507.png

Ailsa-msft_4-1619687060508.png

I have attached my pbix file, you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

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

5 REPLIES 5
v-yetao1-msft
Community Support
Community Support

Hi @MReinagl 

Please correct me if I wrongly understood your question.

(1)We can achieve monthly total through the time hierarchy.

Original matrix visual

Ailsa-msft_0-1619687060501.png

Use time hierarchy function:

Ailsa-msft_1-1619687060504.png

Ailsa-msft_2-1619687060505.png

(2)Create a column to get the average sales per day for the current week .And then add the column in Vaules .

 average = CALCULATE(AVERAGE('Table'[Price]),FILTER('Table','Table'[Date]>MAX('Table'[Date])-7 && 'Table'[Date]<= MAX('Table'[Date])))

Ailsa-msft_3-1619687060507.png

Ailsa-msft_4-1619687060508.png

I have attached my pbix file, you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

this does not really help me I'm afraid.

I want to show the sales for the seven days and then next to it the average across all seven days. Basically like this:

                  Mon   Tue   Wed   Thu   Fri   Sat   Sun    AVG
Product A 100      110      90     90  110  100   100     100
Product B   80        80      70     70    60    50     50   65,71
Product C   40        60      60     60    40    40     40   48,57

 

Thanks

Matthias

MReinagl
Frequent Visitor

OK, I managed to create a measure to show the month-to-date amount. But how do I manage now that this MTD amount is shown only once, i.e. for the last day:

MReinagl_0-1619617475877.png

 

The measure I created is: 

Nettosumme_MTD = CALCULATE(
    TOTALMTD(SUM(tblDATA[Nettosumme]),
    Datum[Date])
)
 
selimovd
Super User
Super User

Hey @MReinagl ,

 

you can calculate the average for the last 7 days like that:

Average last 7 days = 
CALCULATE (
    AVERAGE(myTable[myColumn]),
    DATESINPERIOD (
        'Date'[Date],
        MAX ( 'Date'[Date] ),
        -7,
        DAY
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

OK - but how can I display this now next to the data for the seven days, i.e. right of the columns shown in my screenshot at the top?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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