Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello,
I am attempting to create a SWITCH measure that will return a value for a specific group of Item/SKU numbers. But when I add the measure I want to use the SWITCH function for it is giving incorrect values.
Below are the calculations for UPH and SWITCH (only included partial list of Items/SKUs).
Goal is to have the UPH measures mirror each other. I am fairly new to Power BI and may be using the SWITCH funchtion incorrectly.
Thank you for the assistance.
Solved! Go to Solution.
Sorry, it should be like this:
SWITCH - Select SKUs - UPH =
VAR MySelection = SELECTEDVALUE('devSKUSummary'[SkuNumber])
RETURN
SWITCH(MySelection,
"12761", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12761"),
"12762", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12762"),
"12763",CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12763"),
"21282", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "21282"),
BLANK()
)
Anyway, if it doesn't work, can you post here some dummy data to check?
Hi @JamHam
I have not really understood what you want to do, but if you want to retrieve the value only for selected SKU, then you could do something like this:
SWITCH - Select SKUs - UPH =
SWITCH('devSKUSummary'[SkuNumber],
"12761", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12761"),
"12762", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12762"),
"12763",CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12763"),
"21282", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "21282"),
BLANK()
)
Thank you for the reply. I am attempting to build a measure that pulls UPH for specific skus. Instead of using filters to get the same result. When I look at the sku level the SWITCH calc shows a different number than the UPH calc. Which I would expect the same number to be displayed for the SWITCH and UPH calc. So I am not really sure what would cause this issue.
I attempted to use your updated SWTICH Calc. But it is giving an error on the 'devSKUSummary' [SKUNumber]. Power BI states that it "Cannot Find Name [SKUNumber]". Additionally when I try to enter the calc manually the [SKUNumber] does not show up as an option when I type 'dev in the calc. It is only showing measures being able to be selected.
Sorry, it should be like this:
SWITCH - Select SKUs - UPH =
VAR MySelection = SELECTEDVALUE('devSKUSummary'[SkuNumber])
RETURN
SWITCH(MySelection,
"12761", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12761"),
"12762", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12762"),
"12763",CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "12763"),
"21282", CALCULATE([UPH Calc],'devSKUSummary'[SkuNumber]= "21282"),
BLANK()
)
Anyway, if it doesn't work, can you post here some dummy data to check?
@mlsx4 Your latest Measure got me close to what I needed. I had to add the UPH Calc into the measure to get it to work. But now the results are reporting correctly.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
21 | |
18 | |
14 | |
11 |
User | Count |
---|---|
44 | |
35 | |
25 | |
22 | |
22 |