Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi I am trying to create a formula in DAX with IF but I keep getting errors in the bold area, can someone tell me what I am doing wrong?
This is what I am trying to create
EVALUATE
ADDCOLUMNS(
VALUES( VALIDATED_PD[m_Group_Currency_Amount] ),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name])
)
First make sure your business logic is correct.
1 Does your table `validated_pd` exist?
2 If your table exists, then your same [d_Customer_Name] will be allocated different [m_Group_Currency_Amount]
3 If the second item is satisfied, then you should still lack product information, or Say your "GM" needs to be distinct.
Hi,
I am not sure if I understood your question correctly, but please try something like below.
EVALUATE
ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] )
)
I have this but the bold part doesn't work the "Customer Number" column, the rest does
EVALUATE
ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] ),
"Customer Number",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
VAR f_GM_CustomerNumber = VALIDATED_PD[m_Customer_Number]
RETURN
IF ( f_GM_CustomerPD = "GM", BLANK(), f_GM_CustomerNumber )
)
Is it possible to add more than one IF? for example add to the same code (last part of the code) (Code in DAX Studio is still running for last code)
EVALUATE
ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] ),
"Customer Number",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", BLANK(), VALIDATED_PD[m_Customer_Number] )
)
Hi,
Please share your sample pbix file's link with how your expected outcome looks like.
Thanks.
Hi, I cant share the data but this the code I have
In bold is the part that I am trying to add, above is the suggestion you made
EVALUATE
ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] ),
"Customer Number",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
VAR f_GM_CustomerNumber = VALIDATED_PD[m_Customer_Number]
RETURN
IF ( f_GM_CustomerPD = "GM", BLANK(), f_GM_CustomerNumber )
)
And this the error:
Hi,
Sorry, this does not help to understand what/how is your expected outcome.
Please try something like below.
EVALUATE
table
= ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name],
VALIDATED_PD[m_Customer_Number]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] ),
"Customer Number",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
VAR f_GM_CustomerNumber = VALIDATED_PD[m_Customer_Number]
RETURN
IF ( f_GM_CustomerPD = "GM", BLANK (), f_GM_CustomerNumber )
)
Hi, I cant share the data but this the code I have
In bold is the part that I am trying to add, above is the suggestion you made
EVALUATE
ADDCOLUMNS (
SUMMARIZE (
VALIDATED_PD,
VALIDATED_PD[m_Group_Currency_Amount],
VALIDATED_PD[d_Customer_Name]
),
"Total Overdue", [a_TotalOverdue],
"Customer Name",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
RETURN
IF ( f_GM_CustomerPD = "GM", "GM", VALIDATED_PD[d_Customer_Name] ),
"Customer Number",
VAR f_GM_CustomerPD = VALIDATED_PD[d_Customer_Name]
VAR f_GM_CustomerNumber = VALIDATED_PD[m_Customer_Number]
RETURN
IF ( f_GM_CustomerPD = "GM", BLANK(), f_GM_CustomerNumber )
)
And this the error:
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |