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
Anonymous
Not applicable

Total Sales in Matrix table based on some conditions.

Hello,

I have a sales table with the following tables (exist the attached pbi file) : 

 

RedGC_0-1620062169631.png

  

RedGC_1-1620062206369.png

There's no relationship between sales table and above tables. 

I need to display in Matrix table ( Range int Rows and GM Range in Column) to show Total Sales for those sales that are inside a range ( ex : $7M - $9M) AND in specific GM range (Gross Margin). As a result I should have the following format : 

RedGC_3-1620062652601.png

Here is the Pbi file with Demo Data : https://www.dropbox.com/s/yt6c8sktx3nwzh2/DemoPBI.pbix?dl=0

 

Thanks alot for your help.

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

Two measures are created, and I inserted the second measure into the visualization.

 

Picture3.png

 

Total Sales by Customer by Sales Range =
CALCULATE (
Sales[TotalSales],
FILTER (
VALUES ( Sales[Customer] ),
COUNTROWS (
FILTER (
'Sales Range',
[TotalSales] > 'Sales Range'[Min]
&& [TotalSales] <= 'Sales Range'[Max]
)
) > 0
)
)
 
Total Sales by Customer by salesrange & gmrange =
COALESCE(CALCULATE (
[Total Sales by Customer by Sales Range],
FILTER (
VALUES ( Sales[Customer] ),
COUNTROWS (
FILTER ( 'GM Range', [GM] > 'GM Range'[Min] && [GM] <= 'GM Range'[Max] )
) > 0
)
),0)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

Two measures are created, and I inserted the second measure into the visualization.

 

Picture3.png

 

Total Sales by Customer by Sales Range =
CALCULATE (
Sales[TotalSales],
FILTER (
VALUES ( Sales[Customer] ),
COUNTROWS (
FILTER (
'Sales Range',
[TotalSales] > 'Sales Range'[Min]
&& [TotalSales] <= 'Sales Range'[Max]
)
) > 0
)
)
 
Total Sales by Customer by salesrange & gmrange =
COALESCE(CALCULATE (
[Total Sales by Customer by Sales Range],
FILTER (
VALUES ( Sales[Customer] ),
COUNTROWS (
FILTER ( 'GM Range', [GM] > 'GM Range'[Min] && [GM] <= 'GM Range'[Max] )
) > 0
)
),0)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thanks alot for your help @Jihwan_Kim, your answer worked very good !.
Thanks,  

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.