Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
water-guy-5
Helper III
Helper III

PLEASE help with this equation

I have two types of data points for certain neighborhoods.

First is the type of customer, and second is the amount of customers.
Table 1
Location      Classification    Count

Location A    Residential     50
Location A    Commercial    0
Location B     Residential     100
Location B     Commerical    20
Location C     Residential      75
Location C      Commerical    5

I am trying to write a column that determines if 1) part of the sum contains "Commercial" and if so I want to multiple the total count for Location B by 2.7

If there is NO "Commercial", then I would multiply the total count of Location A by 3.

I already have a measure that summarizes the total counts for certain locations called [Total Count]

Population =
IF ( Table1[Classification] <> "commerical",
CALCULATE(SUMX(Table1, [Total Count] * 2.7)),
CALCULATE(SUMX(Table1, [Total Count] * 3)))
^ this is not working

Any help would be greatly appreciated, thanks!



1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Try:

 

Sum Count = SUM(Table1[Count])

 

 

 

Population =
SUMX (
    ADDCOLUMNS (
        Table1,
        "_calc",
            CALCULATE (
                IF (
                    MAX ( Table1[Classification] ) = "Commercial" && MAX(Table1[ Location]) = "Location B",
                    [Sum Count] * 2.7,
                   IF( MAX ( Table1[Classification] ) <> "Commercial" && MAX(Table1[ Location]) = "Location A", [Sum Count] * 3
                )
            )
)
    ),
    [_calc]
)

 

 

 

 

 

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

Try:

 

Sum Count = SUM(Table1[Count])

 

 

 

Population =
SUMX (
    ADDCOLUMNS (
        Table1,
        "_calc",
            CALCULATE (
                IF (
                    MAX ( Table1[Classification] ) = "Commercial" && MAX(Table1[ Location]) = "Location B",
                    [Sum Count] * 2.7,
                   IF( MAX ( Table1[Classification] ) <> "Commercial" && MAX(Table1[ Location]) = "Location A", [Sum Count] * 3
                )
            )
)
    ),
    [_calc]
)

 

 

 

 

 

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






YukiK
Impactful Individual
Impactful Individual

You'd need to add an additional condition that checkes if the location is A or B, etc, in addision to checking if "Commercial".

 

Hope that helps!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.