<?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: If statement between 2 tables - reproducing sql in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753251#M181977</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;for the prompt response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have replicated the scenario by using sample data.Please go through the attached PBIX file for your reference.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jul 2025 10:41:37 GMT</pubDate>
    <dc:creator>v-venuppu</dc:creator>
    <dc:date>2025-07-04T10:41:37Z</dc:date>
    <item>
      <title>If statement between 2 tables - reproducing sql</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753059#M181972</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;my sql statement is:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;-- This query calculates the applied discount rate for SKUs based on their retail prices and effective prices.
WITH OnDemandPrices AS (
    SELECT DISTINCT PartNumber, PayGPrice
    FROM vnomic_Daily.Fct_EA_AmortizedCosts
    WHERE PricingModel = 'OnDemand'
),
RetailPricing AS (
    SELECT
        a.PricingModel,
        a.BenefitName,
        a.ReservationName,
        a.PayGPrice,
        a.MeterCategory,
        CASE
            WHEN a.PricingModel = 'Reservation' THEN MAX(od.PayGPrice)
            ELSE MAX(a.PayGPrice)
        END as RetailPrice,
        MAX(a.EffectivePrice) as EffectivePrice,
        SUM(a.CostInBillingCurrency) AS SumCostInBillingCurrency
    FROM vnomic_Daily.Fct_EA_AmortizedCosts a
    LEFT JOIN OnDemandPrices od ON a.PartNumber = od.PartNumber
    WHERE a.Date &amp;gt;= '2025-04-01'
    AND a.Date &amp;lt; '2025-05-01'
    GROUP BY
        a.PricingModel,
        a.BenefitName,
        a.ReservationName,
        a.MeterCategory,
        a.PayGPrice,
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;So I have the issue with setting DetailPrice variable using DAX.&amp;nbsp;&lt;BR /&gt;What i would like to do after is to add this detailprice to matrix.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So we have 2 tables here so somehow i need to join tables before applying dax.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What can be your approach ? How you would resolve it?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Jacek&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 07:12:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753059#M181972</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-04T07:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: If statement between 2 tables - reproducing sql</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753106#M181973</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a new calculated table that joins OnDemandPrices and RetailPricing:&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;CombinedTable = &lt;BR /&gt;VAR OnDemandPrices = &lt;BR /&gt;DISTINCT (&lt;BR /&gt;SELECTCOLUMNS (&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts],&lt;BR /&gt;"PartNumber", vnomic_Daily[Fct_EA_AmortizedCosts][PartNumber],&lt;BR /&gt;"PayGPrice", vnomic_Daily[Fct_EA_AmortizedCosts][PayGPrice]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR RetailPricing = &lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts],&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][PricingModel],&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][BenefitName],&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][ReservationName],&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][PayGPrice],&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][MeterCategory]&lt;BR /&gt;),&lt;BR /&gt;"RetailPrice", IF (&lt;BR /&gt;vnomic_Daily[Fct_EA_AmortizedCosts][PricingModel] = "Reservation",&lt;BR /&gt;CALCULATE ( MAX ( OnDemandPrices[PayGPrice] ) ),&lt;BR /&gt;CALCULATE ( MAX ( vnomic_Daily[Fct_EA_AmortizedCosts][PayGPrice] ) )&lt;BR /&gt;),&lt;BR /&gt;"EffectivePrice", CALCULATE ( MAX ( vnomic_Daily[Fct_EA_AmortizedCosts][EffectivePrice] ) ),&lt;BR /&gt;"SumCostInBillingCurrency", CALCULATE ( SUM ( vnomic_Daily[Fct_EA_AmortizedCosts][CostInBillingCurrency] ) )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;RetailPricing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a calculated column or measure for DetailPrice in the CombinedTable:&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;DetailPrice = &lt;BR /&gt;IF (&lt;BR /&gt;CombinedTable[PricingModel] = "Reservation",&lt;BR /&gt;CombinedTable[RetailPrice],&lt;BR /&gt;CombinedTable[EffectivePrice]&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use Detailprice in matrix&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 08:02:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753106#M181973</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-07-04T08:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: If statement between 2 tables - reproducing sql</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753251#M181977</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="107617" data-lia-user-login="jaryszek" class="lia-mention lia-mention-user"&gt;jaryszek&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;for the prompt response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have replicated the scenario by using sample data.Please go through the attached PBIX file for your reference.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 10:41:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753251#M181977</guid>
      <dc:creator>v-venuppu</dc:creator>
      <dc:date>2025-07-04T10:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: If statement between 2 tables - reproducing sql</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753412#M181983</link>
      <description>&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 13:11:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/If-statement-between-2-tables-reproducing-sql/m-p/4753412#M181983</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-04T13:11:06Z</dc:date>
    </item>
  </channel>
</rss>

