Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello! I`m very-very new to Power Bi and, unfortunately, I got stuck with this issue. I have three tables (two tables with facts (costs and traffic) and one table with kyes (for filtering). I`m trying to write a measure, which will show a sum of spent money (a
Solved! Go to Solution.
Hi @Notbad ,
Accourding your picture ,the relationship in your tables:
key_utm_from_BQ to facts_GA_traffic :one to many(1:*)
key_utm_from_BQ to facts_ads_costs:one to many(1:*)
facts_GA_traffic and facts_ads_costs , not with direct relatinship.
So you need to show the relationship throuth dax.
And according your picture ,I create a sample:
key_utm_from_BQ :
facts_GA_traffic:
facts_ads_costs:
Relationship:
your measure:
amount_spent =
VAR sessions =
SUM ( facts_GA_traffic[sessions] )
RETURN
CALCULATE ( SUM ( facts_ads_costs[adCost] ), sessions > 1 )
Return :
And based on the three table ,try following steps:
Step1, create a measure on facts_GA_traffic:
session1 = SUM(facts_GA_traffic[sessions])
Step 2, create measure on facts_ads_costs:
amount_spent =
CALCULATE(SUM(facts_ads_costs[adCost]),FILTER(facts_GA_traffic,facts_GA_traffic[medium]=MAX(facts_ads_costs[medium])&&facts_GA_traffic[session1]>1))
Get result(the figure below, only medium=3 satisfies the condition):
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi @Notbad ,
Accourding your picture ,the relationship in your tables:
key_utm_from_BQ to facts_GA_traffic :one to many(1:*)
key_utm_from_BQ to facts_ads_costs:one to many(1:*)
facts_GA_traffic and facts_ads_costs , not with direct relatinship.
So you need to show the relationship throuth dax.
And according your picture ,I create a sample:
key_utm_from_BQ :
facts_GA_traffic:
facts_ads_costs:
Relationship:
your measure:
amount_spent =
VAR sessions =
SUM ( facts_GA_traffic[sessions] )
RETURN
CALCULATE ( SUM ( facts_ads_costs[adCost] ), sessions > 1 )
Return :
And based on the three table ,try following steps:
Step1, create a measure on facts_GA_traffic:
session1 = SUM(facts_GA_traffic[sessions])
Step 2, create measure on facts_ads_costs:
amount_spent =
CALCULATE(SUM(facts_ads_costs[adCost]),FILTER(facts_GA_traffic,facts_GA_traffic[medium]=MAX(facts_ads_costs[medium])&&facts_GA_traffic[session1]>1))
Get result(the figure below, only medium=3 satisfies the condition):
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
I think this does what you're trying to achieve:
amount_spent =
VAR sessions = SUM(facts_GA_traffic[sessions])
RETURN
IF( sessions > 1,
SUM(facts_ads_costs[adCost]),
BLANK()
)
What you were doing wouldn't work a row in facts_ads_costs has no sessions column to filter on.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |