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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Need to display sales and purchase data in below format using matrix. Please help

Need to display sales and purchase data in below format using matrix. Please help.

 

SonaSingh123_0-1633408937445.png

 

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous ,

 

Any updates?

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

 

I saw a date slicer in your report, so if you want to dynamically change the DAY/WTD/MTD/YTD based on the selected date?

 

For example, if select 2021/10/8 in slicer, then 

DAY:2021/10/8

WTD: 2021/10/4-2021/10/8

...

if select 2021/10/13 in slicer, then 

DAY:2021/10/13

WTD: 2021/10/11-2021/10/13

...

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

 

Not very clear about your requirement. 

But in your case, I think creating a new table for matrix's row is an effective way.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

 

I have used the following formula to built a data table:

Table = ADDCOLUMNS( CALENDAR(DATE(2020,10,1),DATE(2021,12,31)),"Sales",1,"Purchase",2, "Year-Week",YEAR([Date]) *100+WEEKNUM([Date],2))

Eyelyn9_0-1633570529827.png

According to your expected output, {"DAY","WTD","MTD","YTD"} is acted as Row in Matrix visual . 

So I'd suggest you create a new table with a column which contains these values as shown below:

For Matrix = {"DAY","WTD","MTD","YTD"}

Then you could use your seperated measures for Sales and Purchase:

Sales = SWITCH(MAX('For Matrix'[Value]),
"DAY",CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Date]=TODAY())),
"WTD",CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Date]<=TODAY() && [Year-Week]=YEAR(TODAY())*100+WEEKNUM(TODAY(),2))),
"MTD",CALCULATE(SUM('Table'[Sales]),DATESMTD('Table'[Date])),
"YTD",CALCULATE(SUM('Table'[Sales]),DATESYTD('Table'[Date])))

 

 Below is the final output:

Eyelyn9_1-1633570930809.png

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

 

Anonymous
Not applicable

Hi  @Anonymous , thanks a lot for the help. Can we use related function for passing sales and purchase data in data table? In the above example you are passing some static values, right?

Anonymous
Not applicable

hI @Anonymous , Can you please check below sample pbix file. 

https://drive.google.com/file/d/1RKcpJAzfVlVFucnt48tPb3yURC-LtBwu/view?usp=sharing 

amitchandak
Super User
Super User

@Anonymous,  this seems like split measure into measure and dimension

 

examples

 

union(
summarize('Table',"Measure","sales","This period",[SALES YTD],"Last period",[SALES LYTD],"POP",[SALES YOY])
summarize('Table',"Measure","unit","This period",[unit YTD],"Last period",[unit LYTD],"POP",[unit YOY])
)

 

or

union(
summarize('Table',"Measure parent","Measure1","Measure",[Measure1])
summarize('Table',"Measure parent","Measure2","Measure",[Meausre2])
)

 

or


union(
summarize('Table',"Measure","App","Last 7 Days",[APP 7 Day],"Last 14 days",[APP 14 days],"last 21 Days",[APP 21 Days])
summarize('Table',"Measure","App","Last 7 Days",[Leads 7 Day],"Last 14 days",[Leads 14 days],"last 21 Days",[Leads 21 Days])
)

or


union(
summarize('Table','Table'[country],"Revenue","sales","This period",[Revenue YTD],"Last period",[Revenue LYTD],"POP",[Revenue YOY])
summarize('Table','Table'[country],"Costs","unit","This period",[Costs YTD],"Last period",[Costs LYTD],"POP",[Costs YOY])
)

 

You need to add group bys what you need as filter. This new table will not take old slicer filter

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I have created seperated measures for sales and purchase. AlosI want to show split of these measures in a matrix. Any idea?

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.

Top Solution Authors
Top Kudoed Authors