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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MHTANK
Helper III
Helper III

Power bi matrix

Data.png

 this is product sale data

Result.png

 This is result I want.

I want last 15 days from today sales pieces,  average days and total value and that also for last 1 month and last 2 month in same matrix visual.

Please suggest me how to solve this?

Thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @MHTANK ,

What do you mean by import file in power bi?

 

The sample data on my side has a Date type column named Date, not sure how you configure your data.

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @MHTANK

I have made a simple demo for your reference.

 

Write a measure and configure the Matrix as below:

Measure = var _period=SELECTEDVALUE('Periods'[Periods])
var _metics=SELECTEDVALUE('Metrics'[Metric])
var _15ddays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)
var _15dpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)
var _15dvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)<=15)

var _1mays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)
var _1mpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)
var _1mvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=30)

var _2mays= CALCULATE(AVERAGE('Table'[Days]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
var _2mpcs= CALCULATE(count('Table'[Pcs]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
var _2mvalues= CALCULATE(SUM('Table'[Value]), DATEDIFF('Table'[Date],TODAY()-1,DAY)-1<=60)
return 
 if(_period="15 days",if(_metics="Days",_15ddays,if(_metics="Pcs",_15dpcs,if(_metics="Value",_15dvalues))),
 if(_period="1 month",if(_metics="Days",_1mays,if(_metics="Pcs",_1mpcs,if(_metics="Value",_1mvalues))),
  if(_period="2 month",if(_metics="Days",_2mays,if(_metics="Pcs",_2mpcs,if(_metics="Value",_2mvalues))))
 ))

vqiaqimsftv_0-1739860461299.png

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

  1. When I am direct copy and paste data in power bi "Enter data" then this is work, but when I import file in power bi then this is not working
  2. image001.png

Anonymous
Not applicable

HI @MHTANK ,

What do you mean by import file in power bi?

 

The sample data on my side has a Date type column named Date, not sure how you configure your data.

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

 

Import file means file importing via Get Data

speedramps
Super User
Super User

We want to help you but your description is too vague. Please write it again clearly.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

Remove any unneeded columns which may cause confusion.

Rename columns to user friendly names. Avoid your business or system jargon that we may not understand.
 
Also provide the example desired output, with a clear step-by-step description of calculations the process flow.

For example from when is 15 days, 1 month and 2 months derived?  Is it the most recent date on the table or the system date?

 

How is the 3, 27 and 1005 caculated?

 

Give a clear step by step description. Do not post Excel or DAX formulas. Just describe it is plain language. Thank you.

Remember not to share private data ... we don't want you to get into trouble. ‌‌
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions with example data.

Look forward to helping you when the above information is forthcoming

 

 

3 is count of Ref No. ,27 is average of Days and 1005 is sum of value

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.