Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Dear community,
I would like to calculate the revenue per capita for a product in a specified country.
I tried to put this into a dax expression, without success.
My data structure is as follows:
Table A
Country | Product | Revenue |
Country A | Product A | 100 |
Country A | Product B | 200 |
Country B | Product A | 50 |
Country B | Product C | 100 |
… |
Table B
Country | Population |
Country A | 100000 |
Country B | 200000 |
Country C | 50000 |
… |
Table A and Table B are linked in both ways on the column "Country"
I have tried this DAX expression without success, for every product I get the same value.
Solved! Go to Solution.
Hi @skean21 please create this measure in tableA.
Measure =
VAR _country = MAX(TableA[Country])
VAR _population = CALCULATE(SUM(TableB[Population]),TableB[Country]=_country)
VAR _revenue = SUM(TableA[Revenue])
RETURN DIVIDE(_revenue,_population,0)
Hi @skean21 please create this measure in tableA.
Measure =
VAR _country = MAX(TableA[Country])
VAR _population = CALCULATE(SUM(TableB[Population]),TableB[Country]=_country)
VAR _revenue = SUM(TableA[Revenue])
RETURN DIVIDE(_revenue,_population,0)
User | Count |
---|---|
47 | |
27 | |
23 | |
18 | |
15 |
User | Count |
---|---|
55 | |
34 | |
18 | |
17 | |
15 |