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.
Hi
I'm used to apply SUM.IF in Exel but I don't know how do the same via a Measure in Power BI.
I will illustrate my problem by an example. Let's say I have this data:
Sales opportunity, unique# | Sales prize | Revenue | Is the car blue? | Is the car a 4WD | Does the car have backseats? |
11 | 100 | 25 | True | False | True |
12 | 300 | 40 | False | False | False |
13 | 250 | 35 | False | False | False |
14 | 175 | 20 | False | True | False |
15 | 100 | 20 | False | False | False |
16 | 75 | 10 | True | False | True |
17 | 375 | 55 | True | True | True |
If I want to calculate and index that tells my what the average revenue is on all sales, I use this formula to create a Measure: Rev_average = (SUM (Data[Revenue]))/(COUNTROWS(Data)) * 100
My problem is that I also want to calculate revenue based on the entries where and only if one of the following values is true: “Is the car blue?”, “Is the car a 4WD”, ”Does the car have backseats?” So if all values is false it will not count in the average revenue.
Does anyone know how to do that?
BR
Anders
Solved! Go to Solution.
1. create the conditional filed which i mention in first reply on this post like this.
2. Create one calculation or Directly drag the Value measure into the card and choose as Average
3. Darg the final Condtional Column into visual filter and choose greater than "0" Thats it Dude.
Yes, @Baskar 's solution works fine for that purpose.
But if you're after a more robust solution, this measure would do:
NewAverage = CALCULATE(AVERAGE('Table2'[Revenue]), FILTER(Table2, 'Table2'[Include]=1))
No need to switch to Average in the report-design then.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
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 |
---|---|
110 | |
98 | |
78 | |
64 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |