Forum Discussion
Need Help with Data Model / DAX
- 1 year ago
sree2604
Please create proper data model rather than only create DAX.. beacuse DAX works on relationship.. Your two tables have different grain so you should have two fact table.. Below is the complete screenshot of your data modelYou need to have a simple star schema
Complete pbix file is attached below.
Hope it helps
Regards
sanalytics
sree2604 First, ensure that you have a relationship between your Sales table (Table 1) and Lives table (Table 2) based on the appropriate columns (e.g., Sales Rep, District, State, Country).
Create a measure to calculate the total lives for the selected area:
Total Lives :=
SUM('Table 2'[Lives (in M)])
Create a measure to calculate the total sales:
DAX
Total Lives :=
SUM('Table 2'[Lives (in M)])
Create a measure to calculate the total sales:
DAX
Total Sales :=
SUM('Table 1'[Sales])
Finally, create a measure to calculate Sales per Million Lives:
DAX
Sales per Million Lives :=
DIVIDE([Total Sales], [Total Lives] * 1000000, 0)