Forum Discussion
DAX SWITCH TRUE - help needed
Hi DavePBI
Its because of 2 problem:
1. delimiters. You should use only ";" or "," depends on locale. I bet ";" in your case will be correct
2. double [[. use the only [SoortRelatie], not [[SoortRelatie]]
Hi az38,
Thanks for getting back to me. Thanks for feedback. I made a mistake on sending incorrect image on that. See below the correct one.
As you can see issue is coming from fact that it cannot find column 'IncassoProvisie_Jr' due to fact that it is a secondary linked table.
So to expain further, I have 3 tables in this setting. VW_Dim_Relatie is linked 1 to * with a 2nd table and that second table is linked with also 1 to * connection to the 3rd table VW_Fact_Dekking that holds the column 'IncassoProvisie_Jr' that I need.
Any idea to overcome this? Thanks again for feedback.
- az386 years ago
Community Champion
The issue is you have a few related rows from VW_Fact_Dekking table
So, you have to define logic to what exactly related value you want to use. It can be MAX, MIN, SUM, etc.. or FIRSTNONBLANK.
for example
EK = var _IncassoProvisie_Jr = CALCULATE(FIRSTNONBLANK(VW_Fact_Dekking[IncassoProvisie_Jr]);1) RETURN SWITCH(TRUE(); VW_Dim_Relatie[SoortRelatie] = "00010" && _IncassoProvisie_Jr=0; "0"; VW_Dim_Relatie[SoortRelatie] = "00010" && _IncassoProvisie_Jr < 100; "PB"; "no_status" )or
EK = var _IncassoProvisie_Jr = CALCULATE(MIN(VW_Fact_Dekking[IncassoProvisie_Jr])) RETURN SWITCH(TRUE(); VW_Dim_Relatie[SoortRelatie] = "00010" && _IncassoProvisie_Jr=0; "0"; VW_Dim_Relatie[SoortRelatie] = "00010" && _IncassoProvisie_Jr < 100; "PB"; "no_status" )- DavePBI6 years agoFrequent Visitor
Hi az38,
Thanks so much for that. Really helpfulp it provides no errors anymore and returns the value.
It seems I am almost there, however when checking the label (like PB etc). It seems not to be correct always. Sometimes it should return a PZ but then gives a PG label...
Maybe this comes due to fact that I used SUM in the logic line. I did that as there are in _Incassoprovisie_Jr multiple rows with value within one single Relation, so that is why I took SUM. But maybe that is the issue and I should be usings something else instead?
Thanks again you are of great help....!!!
- Anonymous6 years agoNot applicableIf your table is linked to another via 1:*, then, first of all, there may be many values in the second table for a single row in the first table and secondly, to reach the "many" side of the relationship you have to use RELATEDTABLE.
I'd suggest you think well over again what you want to do because what you are trying to do right now is not doable.
Best
D