<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Matrix with different grain in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602736#M46471</link>
    <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/483272"&gt;@shri2785&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
    <pubDate>Wed, 27 Dec 2023 02:21:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-12-27T02:21:00Z</dc:date>
    <item>
      <title>Matrix with different grain</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3601879#M46448</link>
      <description>&lt;P&gt;Dear Power BI Guru's&lt;/P&gt;&lt;P&gt;Being new to PBI , trying to resolve on situation at my end&lt;/P&gt;&lt;P&gt;Below is the requirement&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Sales orders should be shown at hourly basis, based on the city and Revenue per City.&lt;/P&gt;&lt;P&gt;Sales order is calculated on time / hourly basis&lt;/P&gt;&lt;P&gt;where as Revenue at city.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1:00 AM&lt;/TD&gt;&lt;TD&gt;2:00 AM&lt;/TD&gt;&lt;TD&gt;3:00 AM&lt;/TD&gt;&lt;TD&gt;4:00 AM&lt;/TD&gt;&lt;TD&gt;5:00 AM&lt;/TD&gt;&lt;TD&gt;6:00 AM&lt;/TD&gt;&lt;TD&gt;7:00 AM&lt;/TD&gt;&lt;TD&gt;8:00 AM&lt;/TD&gt;&lt;TD&gt;9:00 AM&lt;/TD&gt;&lt;TD&gt;10:00 AM&lt;/TD&gt;&lt;TD&gt;11:00 AM&lt;/TD&gt;&lt;TD&gt;Revenue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;City&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;$4,500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the Matrix to aggregate the sales orders at hourly but when i add the Revenue the matrix fails to add.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Little background:&lt;/P&gt;&lt;P&gt;Fact table with Sales order detail is joined with Dim calendar&lt;/P&gt;&lt;P&gt;One of the transaction datetime is split into hour column ex 2023-12-20 02:38:45 PM as 02:00 PM using dax&lt;/P&gt;&lt;P&gt;Based on the hour column we are aggregating the sales order in matrix.&lt;/P&gt;&lt;P&gt;Revenue is the sum(net sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please revert if more info reqquired. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 09:02:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3601879#M46448</guid>
      <dc:creator>shri2785</dc:creator>
      <dc:date>2023-12-26T09:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with different grain</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602067#M46455</link>
      <description>&lt;P&gt;It sounds like you want to create a matrix visual that shows the sales orders by hour and city, as well as the revenue by city. One possible solution is to use a measure that calculates the revenue for each city using the SUMX function. For example, you can create a measure like this:&lt;/P&gt;&lt;P&gt;Revenue by City = SUMX(VALUES('Fact Table'[City]), CALCULATE(SUM('Fact Table'[Revenue])))&lt;/P&gt;&lt;P&gt;This measure will iterate over the unique values of the city column in the fact table, and calculate the sum of the revenue for each city. You can then add this measure to the matrix visual, along with the sales order measure and the hour and city columns. You should see something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;City 1:00 AM 2:00 AM 3:00 AM 4:00 AM 5:00 AM 6:00 AM 7:00 AM 8:00 AM 9:00 AM 10:00 AM 11:00 AM Revenue by City&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Lahore&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;$4,500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Karachi&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;89&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;TD&gt;$3,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Islamabad&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;$2,500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this helps you with your Power BI project.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 11:11:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602067#M46455</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-26T11:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with different grain</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602142#M46457</link>
      <description>&lt;P&gt;Dear 123abc, thanks for your quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes i have implemented the SUMX as mentioned for revenue by city but now the challenge is that the Measure cant be added to Rows of Matrix visual. If possible can you share the pbix file where u have added the Revenue by city to Matrix visual on Rows. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 12:26:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602142#M46457</guid>
      <dc:creator>shri2785</dc:creator>
      <dc:date>2023-12-26T12:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with different grain</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602736#M46471</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/483272"&gt;@shri2785&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 02:21:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3602736#M46471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-27T02:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with different grain</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3603055#M46484</link>
      <description>&lt;P&gt;revised method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To address your requirement in Power BI, you need to create a matrix that shows sales orders at an hourly basis based on the city and also shows the revenue per city. The key is to ensure that you have the right relationship between your fact and dimension tables and then use DAX measures to aggregate data appropriately.&lt;/P&gt;&lt;P&gt;Here's a step-by-step guide to help you achieve this:&lt;/P&gt;&lt;H3&gt;Step 1: Ensure Proper Data Modeling&lt;/H3&gt;&lt;P&gt;Make sure your data model in Power BI has the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A fact table (SalesOrderDetail) that contains columns like OrderDateTime, City, SalesOrderID, and NetSales.&lt;/LI&gt;&lt;LI&gt;A date dimension table (DimCalendar) that should have a column for each hour of the day, i.e., 1:00 AM, 2:00 AM, and so on.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;Step 2: Create Hourly Bins in DAX&lt;/H3&gt;&lt;P&gt;You mentioned that you've already created an hour column. If not, you can create a calculated column or measure to extract the hour from the OrderDateTime field.&lt;/P&gt;&lt;H3&gt;Step 3: Create DAX Measures&lt;/H3&gt;&lt;H4&gt;Measure for Sales Orders:&lt;/H4&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales Orders = COUNTROWS('SalesOrderDetail')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H4&gt;Measure for Revenue:&lt;/H4&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revenue = SUM('SalesOrderDetail'[NetSales])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;H3&gt;Step 4: Build the Matrix&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;Drag and drop the City column into the Rows field of the matrix.&lt;/LI&gt;&lt;LI&gt;Drag the hour bins (1:00 AM, 2:00 AM, etc.) from the DimCalendar table into the Columns field of the matrix.&lt;/LI&gt;&lt;LI&gt;Drag the Sales Orders measure into the Values field of the matrix.&lt;/LI&gt;&lt;LI&gt;Now, to show the revenue per city, you can drag the Revenue measure into the Values field of the matrix as well.&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Step 5: Adjust Aggregation and Relationships&lt;/H3&gt;&lt;P&gt;Ensure that relationships between your tables are correctly set up. The relationship should be based on the City and the Hour column you've created or the OrderDateTime column.&lt;/P&gt;&lt;H3&gt;Step 6: Display Revenue Correctly&lt;/H3&gt;&lt;P&gt;If adding both Sales Orders and Revenue in the Values field of the matrix causes issues with aggregation, you can create a separate matrix or table visual for Revenue. Alternatively, ensure that there's no conflict in the way you've structured your DAX measures.&lt;/P&gt;&lt;H3&gt;Final Notes:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;Ensure that you've set up relationships between tables properly.&lt;/LI&gt;&lt;LI&gt;Make sure your DAX measures are using the correct columns and are aggregating data as expected.&lt;/LI&gt;&lt;LI&gt;Adjust formatting and visualization settings in Power BI to make the report more readable and intuitive.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;By following these steps and ensuring that your data model and DAX measures are correctly structured, you should be able to create a matrix that displays sales orders at an hourly basis based on the city and also shows the revenue per city.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Dec 2023 07:37:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Matrix-with-different-grain/m-p/3603055#M46484</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-27T07:37:54Z</dc:date>
    </item>
  </channel>
</rss>

