Forum Discussion
Dax Measure with related Table
Hi coolshib,
Please establish a relationship between 3 tables and try the following measure for
Total Sales =SUMX(Table3,IF(Table3[Mode]="Online",RELATED(Table1[Online Price]),RELATED(Table1[Offline Price]))*Table3[Qty])
Here is the snapshot of the output
You can download the Power Pivot file from here
Hope it helps
16 Replies
- ChandeepChhabra
Impactful Individual
Hi coolshib,
Please establish a relationship between 3 tables and try the following measure for
Total Sales =SUMX(Table3,IF(Table3[Mode]="Online",RELATED(Table1[Online Price]),RELATED(Table1[Offline Price]))*Table3[Qty])
Here is the snapshot of the output
You can download the Power Pivot file from here
Hope it helps
- venug20
Resolver I
- coolshib
Helper III
Thank you Mr.Chhabra ( ChandeepChhabra ) for the solution. It works like a charm.
I have one more query regarding this issue, what if i have more than two modes of payment like "Online Transfer, Cash Payment, Credit Card, Debit Card" etc instead of "Offline & Online only".
Thank you so much for your promt reply.
Best Regards
Shib
- ChandeepChhabra
Impactful Individual
You can establish a relation between Table1 and Table 3 with a bit of modification using Power Query
Please download the power bi file
- venug20
Resolver I
- coolshib
Helper III
Thank you so much for your reply venug20.
Actually i am looking for dax measure which would return the value in a single column.
Also i dont want to add or delete any column from Table No.3 as mentioned above. The format will remain the same. In your solution you have added the category column in the dataset which i don't want.
Best Regards
Shib- venug20
Resolver I
I am trying to display same column calculation field (Online, offline). till not achieve..
you can try inthe mean while, i will provide dax formula which i has got upto till now....
Online Sales = CALCULATE(SUM('Product'[Sales.Quantity]) * SUM('Product-Price'[Online Price]), FILTER('Product', 'Product'[Category] = RELATED('Product-Price'[Category]) && 'Product'[Sales.Mode] = "Online"))
Offline Sales = CALCULATE(SUM('Product'[Sales.Quantity]) * SUM('Product-Price'[Offline Price]), FILTER('Product', 'Product'[Category] = RELATED('Product-Price'[Category]) && 'Product'[Sales.Mode] = "Offline"))
- Ashish_Mathur
Super User
- Ronald123
Resolver III
Hi Ashish_Mathur,
Why the SUMX formule >
Total sales = SUMX(SUMMARIZE(Table1;Products[Product Name];'Mode of payment'[Mode];"ABCD";[Price per unit]*[Quantity sold]);[ABCD])If this formule give the same results.
Total Sales2 = [Quantity sold]*[Price per unit]
Greets,
Ronald
- Ashish_Mathur
Super User
Hi,
Your measure would give the correct row wise totals but the incorrect grand total.
- coolshib
Helper III
Thank you so much.. Great Help.
Best Regards
Shib
- Ashish_Mathur
Super User
Hi,
If my reply helped, please mark it as Answer.