Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Dear Community,
I am having an issue with my Switch True function.
I want to create a string column out of an integer column.
The DAX functio is seen below.
It works fine and I can use it to develop my visuals.
The issue: when I click on the "Save"button to close my Power BI desktop, I get an error;
The syntax for '"Young"' is incorrect. (DAX(SWITCH( True(),'Main practice adopted'[Age_in_adopt] = BLANK() , " ",'Main practice adopted'[Age_in_adopt] <18. "Young",'Main practice adopted'[Age_in_adopt] >= 18 && 'Main practice adopted'[Age_in_adopt] <=35. "Youth",'Main practice adopted'[Age_in_adopt] >=35. "Old"))).
I tried using IF functions too, the same error happened.
Kindly help me on how to go about the error.
Thank you
Solved! Go to Solution.
@AmaGreen Well, it is indeed strange. I recreated the data and the column and no issues saving. What versino of the Desktop are you on? I attached my PBIX, perhaps you can open it and try saving it and see if you get the error?
@Greg_Deckler I am sharing the data file with you.
Due to confidentailty, I cannot share the file publicly.
Thanks for understanding.
Select_benefic.registered_year | Select_benefic.pull_gender | Select_benefic.pull_date | Select_benefic.pull_idcode_note | Select_benefic.pull_id | AdoptPractices.Adoptedpract | AdoptPractices.Noadoption | AdoptPractices.essentpractise | AdoptPractices.essentialpract_numb | AdoptPractices.two_morepractice | AdoptPractices.whataddopted | AdoptPractices.whataddopted_numb | AdoptPractices.whatadopted_other | AdoptPractices.whataddopted_numb_note | AdoptPractices.practicesonearea | AdoptPractices.whatadd_note_number | AdoptPractices.practice_count | Gender_in_adopt | Gender_adopted | Age_in_adopt | Age_range |
Male | 03/10/2023 12:06:30 | Yes | Use_of_improved_seeds | 1 | Yes | Manual_ploughing Sowing_compass_and_density_(intercropping_spacing) | 2 | Yes | Male | Male | 33 | Youth | ||||||||
2023 | Male | 26/10/2023 08:55:37 | Yes | integrated_pest_mgt | 1 | No | Drip_irrigation Irrigation_with_sprinklers | 2 | No | 2 | Male | 49 | Old | |||||||
Other | Male | 03/10/2023 12:06:30 | 3701184870140 | No | 0 | 0 | Female | 40 | Old | |||||||||||
Male | 03/10/2023 12:06:30 | Yes | water_management Use_of_improved_seeds Crop_rotation | 3 | Yes | Use_of_pedestral_pump_for_irrigation Transport_by_open_channel_to_the_field Transport_by_closed_channel_(pipes)_to_the_field | 3 | Yes | ||||||||||||
2023 | Female | 26/10/2023 09:31:28 | Yes | mulching integrated_pest_mgt | 2 | Yes | Manual_ploughing Ploughing_with_animal_traction Land_preparation_with_sulches | 3 | Yes | Female | Female | 38 | Old |
@AmaGreen Well, it is indeed strange. I recreated the data and the column and no issues saving. What versino of the Desktop are you on? I attached my PBIX, perhaps you can open it and try saving it and see if you get the error?
Thank you.
I copied and pasted yours.
I don't know why it didnt work for me.
I use Power BI desktop version: 2.124.2028.0 64-bit (December 2023)
@AmaGreen Yep, that's the same one I use. Super weird.
@AmaGreen That's very strange. Any chance you can share the PBIX file?
User | Count |
---|---|
93 | |
85 | |
78 | |
68 | |
62 |
User | Count |
---|---|
113 | |
99 | |
96 | |
64 | |
58 |