2 tables
1 TopicIf statement between 2 tables - reproducing sql
Hello, my sql statement is: -- 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 >= '2025-04-01' AND a.Date < '2025-05-01' GROUP BY a.PricingModel, a.BenefitName, a.ReservationName, a.MeterCategory, a.PayGPrice, ) So I have the issue with setting DetailPrice variable using DAX. What i would like to do after is to add this detailprice to matrix. So we have 2 tables here so somehow i need to join tables before applying dax. What can be your approach ? How you would resolve it? Best, JacekSolved581Views0likes3Comments