Forum Discussion
If statement not totalling
Hi Charli2516 - You can achieve this using the SUMX function
create below measure:
NEW CUSTOMER CY =
SUMX(
VALUES(TableName[CustomerID]), -- Replace 'TableName[CustomerID]' with the column that uniquely identifies your customers
IF(
AND([SALES LY 2023] = 0, [SALES CY 2024] > 0),
1,
0
)
)
Hope the above works. please check.
- Charli25161 year agoNew Member
i have put the new calculation in the 'Total New Customers' Column, and as you can see this doesnt pull through the same data as the 'New Customer CY'. It does total however..?
- rajendraongole11 year agoSuper User
Hi Charli2516 - can you please modify and update the rows and the total, modify NEW CUSTOMER CY to use the same row-by-row logic applied in Total New Customers.
NEW CUSTOMER CY =
SUMX(
VALUES('YourTable'[Customer]),
IF(AND([SALES LY 2023] = 0, [Sales CY 2024] > 0), 1, 0)
)Add a table visual with detailed columns (e.g., Customer, [SALES LY 2023], [Sales CY 2024]).
Verify the row-level logic and ensure [SALES LY 2023] and [Sales CY 2024] return the expected values.- Charli25161 year agoNew Member
I have already done a table to show the logic.
The New customer CY shows that they have sales in 2024 so they should be a 1 for a new customer, but the new formula you have provided doesnt show the 1 in all the customers when it should?