Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello, I have the problem to build a measure in which I multiply by a factor when a condition is met.
For Example - Fact Table
Name | Amount | Date |
Adidas | 100 | 30.10.2022 |
Nike | 100 | 30.10.2022 |
Adidas | 100 | 30.10.2021 |
Amazon | 100 | 30.10.2022 |
Factor Table (Dim)
Name | Bonus | Year |
Adidas | 2,4% | 2021 |
Adidas | 3% | 2022 |
Amazon | 3,7% | 2022 |
Nike | 1,2% | 2022 |
Thus, I would like to build a measure that correctly calculates the total bonus. Important here, for each customer and each year (when the product was sold) there is a different bonus.
With a deep dive on individual customers, the correct bonus should also be displayed.
I am just lost and don't know where to start, let alone how a measure should look like, since the information of the customer name is available in a column, and a measure can't pull any text information from a column like if I want to start with an if calculation.
Thanks for any input.
Solved! Go to Solution.
Hi,
I am not sure how your datamodel looks like, but please check the below pictures and the attached pbix file whether it suits your requirement.
Total bonus: =
SUMX (
DISTINCT ( 'Name'[Name] ),
CALCULATE (
SUMX (
'Fact',
'Fact'[Amount]
* MAXX (
FILTER (
Bonus,
Bonus[Name] = RELATED ( 'Name'[Name] )
&& Bonus[Year] = YEAR ( EARLIER ( 'Fact'[Date] ) )
),
Bonus[Bonus]
)
)
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi @T_JF2022 ,
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I am not sure how your datamodel looks like, but please check the below pictures and the attached pbix file whether it suits your requirement.
Total bonus: =
SUMX (
DISTINCT ( 'Name'[Name] ),
CALCULATE (
SUMX (
'Fact',
'Fact'[Amount]
* MAXX (
FILTER (
Bonus,
Bonus[Name] = RELATED ( 'Name'[Name] )
&& Bonus[Year] = YEAR ( EARLIER ( 'Fact'[Date] ) )
),
Bonus[Bonus]
)
)
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
42 | |
28 | |
24 | |
20 | |
16 |
User | Count |
---|---|
54 | |
35 | |
18 | |
18 | |
15 |