cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FrankWoody
Helper I
Helper I

Help me create Calculated Column

I have a column containing items like A,B,C,D.
I would like to create a calculated column evaluating the following question: If the row of this column is equal to "A" then return 100%, If the row of this column is equal to "B" then return 85% ,
the row of this column is equal to "C" then return 65%, the row of this column is equal to "D" then return 50%. is it possible to do that ?

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@FrankWoody 

 

Column = 
SWITCH(
	'Table'[Item Column],
	"A", 1,
	"B", 0.85,
	"C", 0.65,
	"D", 0.5
)

 


And then, format this column as percentage


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

View solution in original post

3 REPLIES 3
FrankWoody
Helper I
Helper I

THANKS So much !
Now is there any way for me to assign these values to specific texts, if I have a character set and want to filter a part of the text of the line does it also work?

SpartaBI
Community Champion
Community Champion

@FrankWoody my pleasure. 
Sure you can, check out this function:
https://dax.guide/containsstring/
You can also explore there related functions.
Don't forget to mark my previous respond as a solution for comunity visabilty.

P.S. check out my showcase report:
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂


SpartaBI
Community Champion
Community Champion

@FrankWoody 

 

Column = 
SWITCH(
	'Table'[Item Column],
	"A", 1,
	"B", 0.85,
	"C", 0.65,
	"D", 0.5
)

 


And then, format this column as percentage


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors