The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
77 | |
72 | |
47 | |
39 |
User | Count |
---|---|
138 | |
108 | |
69 | |
64 | |
57 |