The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All ,
I'm looking at making this type of logic into a measure but not sure how to :
CC 2 =
If CC 1 = -1 then = 0
If CC 1 = 0 then use "Total Solar"
If CC 1 = 1 then use "Total Cons"
If CC 1 = 2 then use "BSP 1" - "Nursery"
If CC 1 = 3 then use "Art Design" - "MFL & Humanities and Thornton"
If CC 1 = 4 then use "Main School" - "Art & Design"
So it refrences a conditonal column that says if CC 1 = A certain value use a different Measure .
Thanks James.
Solved! Go to Solution.
So CC1 is a calculated column that will appear in the visual and the other items listed are all existing measures?
CC2 =
Switch(
SelectedValue(table[CC1])
,-1, 0
,0, [Total Solar]
,1, [Total Cons]
,2, [BP 1] - [Nursery]
,3, [Art Design] - [MFL & Humanities and Thornton]
,4,[Main School] - [Art & Design]
)
If you are happy with this answer please mark as a solution for others to find !
Kudos are always appreciated! Check out our free Power BI video courses.
Your solution is worked perfect SamWiseOwl
Hi, @JamesBurke
I've created this example data:
I have a cc1 conditional column:
Then use the SamWiseOwl measure:
CC2 = SWITCH(TRUE(),
SELECTEDVALUE('Table'[CC1]) = -1,0,
SELECTEDVALUE('Table'[CC1]) = 0,[Measure1],
SELECTEDVALUE('Table'[CC1]) = 1,[Measure2],
SELECTEDVALUE('Table'[CC1]) = 2,[Measure3]
)
It works flawlessly:
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
CC 2 =
SWITCH(
TRUE(),
[CC 1] = -1, 0,
[CC 1] = 0, [Total Solar],
[CC 1] = 1, [Total Cons],
[CC 1] = 2, [BSP 1] - [Nursery],
[CC 1] = 3, [Art Design] - [MFL & Humanities and Thornton],
[CC 1] = 4, [Main School] - [Art & Design],
BLANK()
)
If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
So CC1 is a calculated column that will appear in the visual and the other items listed are all existing measures?
CC2 =
Switch(
SelectedValue(table[CC1])
,-1, 0
,0, [Total Solar]
,1, [Total Cons]
,2, [BP 1] - [Nursery]
,3, [Art Design] - [MFL & Humanities and Thornton]
,4,[Main School] - [Art & Design]
)
If you are happy with this answer please mark as a solution for others to find !
Kudos are always appreciated! Check out our free Power BI video courses.