Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello all,
I have an issue with a DAX function, I want to make equivalent to this:
Solved! Go to Solution.
Hi @missmanou26 ,
As checked the model in your report file, there is no direct relationship between the table D_SOCIETE and D_IMMEUBLE. So it would get the error when using RELATED ( D_SOCIETE[SOC_OPE_DEF] ) in the formula.... I updated your sample pbix file(see the attachment), please check if that is what you want. Please update the formula of calculated column [Operation_GL] as below:
Operation_GL =
VAR _sksoc =
CALCULATE (
MAX ( 'TR_TIERS'[SK_SOC] ),
FILTER ( 'TR_TIERS', 'TR_TIERS'[SK_IMM] = 'D_IMMEUBLE'[SK_IMM] )
)
VAR _sod =
CALCULATE (
MAX ( D_SOCIETE[SOC_OPE_DEF] ),
FILTER ( 'D_SOCIETE', 'D_SOCIETE'[SK_SOC] = _sksoc )
)
RETURN
IF ( ISBLANK ( D_IMMEUBLE[IMM_OPE] ), _sod, D_IMMEUBLE[IMM_OPE] )
Best Regards
Sorry, I've just granted the permissions.
Thank you !
Hi @missmanou26 ,
As checked the model in your report file, there is no direct relationship between the table D_SOCIETE and D_IMMEUBLE. So it would get the error when using RELATED ( D_SOCIETE[SOC_OPE_DEF] ) in the formula.... I updated your sample pbix file(see the attachment), please check if that is what you want. Please update the formula of calculated column [Operation_GL] as below:
Operation_GL =
VAR _sksoc =
CALCULATE (
MAX ( 'TR_TIERS'[SK_SOC] ),
FILTER ( 'TR_TIERS', 'TR_TIERS'[SK_IMM] = 'D_IMMEUBLE'[SK_IMM] )
)
VAR _sod =
CALCULATE (
MAX ( D_SOCIETE[SOC_OPE_DEF] ),
FILTER ( 'D_SOCIETE', 'D_SOCIETE'[SK_SOC] = _sksoc )
)
RETURN
IF ( ISBLANK ( D_IMMEUBLE[IMM_OPE] ), _sod, D_IMMEUBLE[IMM_OPE] )
Best Regards
Yes it worked ! Thank you very much for your help
Hi @missmanou26 ,
It seems that what you are trying to create is a measure, that's why you got that error message. You can get more details in the following blog...
DAX error messages in Power BI
You can create a calculated column as below in the table 'D_IMMEUBLE' to replace the current measure:
Column =
IF (
D_IMMEUBLE[IMM_OPE] = BLANK (),
RELATED ( D_SOCIETE[SOC_OPE_DEF] ),
D_IMMEUBLE[IMM_OPE]
)
If the above one can't help you, could you please provide some raw data in the table 'D_IMMEUBLE' and 'D_SOCIETE' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hello @v-yiruan-msft
I already tried to create a calculated column but I get also an error. Here's a simplified pbix file.
https://drive.google.com/file/d/1zMRU1VXHPyMolfVGeqUQxQNevrmGHknO/view?usp=share_link
Thanks a lot for your help.
Hi @missmanou26 ,
It seems that I don't have the proper access to your shared file, could you please grant me the sufficient permission to it? Thank you.
How to upload PBI in Community
Best Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |