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
Pandetbaby
Frequent Visitor

Using IF function - but still want to be able to sum results (as numeric) ...?

Hey!

I'm trying to update a rewards program at work where we want to be able to both see if (yes/no) a customer deserves a reward, but also group the level of reward each reacieve in form a points. 

 

I've managed to establish Yes/ No by using  = IF (Purchase >= 92 , "Yes", "No")

E.g. if Purchase is over 92 then Yes they should recieve an award, otherwise no

(92% represents the % the limit they need to hi)

 

I've similarly been able to use the If function to group the points = IF(Purchase = 92, "100",

IF(Purchase = 93, "200",
IF(Purchase = 94, "300", "0")))
This successfully groups the customers into groups based on the % they have hit (e.g. they show up in a table as 92% represents 100 , while 94% represents 300)
 
My problem is however that I cant sum up the to total amount of points collected. 
As I want to track the total per month - the IF formula does not seem to be beneficial.
 
I would very much appreciate it if someone could suggest another formula where I can still group the data but keep the results as numeric values that can be summarized in a table. 
 
Thank you!
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Pandetbaby  why don't you try 

points = IF(Purchase = 92, 100,

IF(Purchase = 93, 200,
IF(Purchase = 94, 300, 0)))

OR 
SWITCH(TRUE()
                    ,Purchase = 92,100
                    ,Purchase  = 93, 200
                    ,Purchase = 94, 300,0)

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Pandetbaby  why don't you try 

points = IF(Purchase = 92, 100,

IF(Purchase = 93, 200,
IF(Purchase = 94, 300, 0)))

OR 
SWITCH(TRUE()
                    ,Purchase = 92,100
                    ,Purchase  = 93, 200
                    ,Purchase = 94, 300,0)

Hey

@Anonymous 

 

Am I supposed to write out the IF formula first and then
OR
SWITCH( TRUE () etc ?

Anonymous
Not applicable

No ... just use this. Same thing can be done with switch in case you have multiple conditions

points = IF(Purchase = 92, 100,

IF(Purchase = 93, 200,
IF(Purchase = 94, 300, 0)))
 
 

Hey @Anonymous ,
I have successfuly done that, however my issue is that I cant add the points together using this formula it appears. 

 

I get 
Month 1 = 100

Month 2 = 300

Month 3 = 100 

 

But I can't make any of the visuals sum them up to column/row totals

Anonymous
Not applicable

Create a measure 
Measure = sum('table'[Points])
Or else share some sample data along with expected result

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.

Top Solution Authors