Power BI and DAX

css navigation by Css3Menu.com

Using VAR in Calculations

We have all built those IF statements that go on and on and when you look back at it, you scratch your head. My friend taught me this Column thing using DAX. Ask the question, give it the answers for TRUE and finally if its FALSE.
MO Type =
   VAR MOT =
	LEFT( qryMOemp[Manf],2)   Pick your test
RETURN	 Perform the test
	SWITCH (
	    TRUE (),	 What to do if TRUE
		MOT = "MO", "MO",
		MOT = "RW", "Rework",
		MOT = "SA", "Sample",
			"Other"	 Finally if none TRUE
	       )



Talk about embarrassing. I put the example in and uploaded my updates to the site. Next morning, I look at the new examples and the before was there. Never program in the middle of the night.

© 2018-2024

Updated:  06/21/2024 07:42
This page added:  21 November 2018