The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi community, i have a problem with my formula.
i have create a measure based on new columns:
Solved! Go to Solution.
Hi @PedroPascual ,
Please try below dax formula:
Yes =
VAR _a =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-501] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _b =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-502] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _c =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-503] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _d =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-504] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _e =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-505] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _f =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-506] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _g =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-508P] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
RETURN
_a + _b + _c + _d + _e + _f + _g
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PedroPascual ,
Please try below dax formula:
Yes =
VAR _a =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-501] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _b =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-502] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _c =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-503] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _d =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-504] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _e =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-505] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _f =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-506] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
VAR _g =
COUNTROWS (
FILTER (
ALL ( '_CombinedMasterFile' ),
'_CombinedMasterFile'[5E-508P] = "YES"
&& CONTAINSSTRING ( '_CombinedMasterFile'[Column1], "value1" )
)
)
RETURN
_a + _b + _c + _d + _e + _f + _g
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hii,
Use the SEARCH function to detect "value1" in Column1. Wrap with ISNUMBER to verify if the substring exists. Then, incorporate this into an IF statement. If "value1" exists in the current row of Column1, your measure's calculations are executed. If not, it returns a default value like BLANK(). Ensure the context of MIN fits your table structure; adjust if necessary.
Does this then work?
CALCULATE(COUNTROWS('_CombinedMasterFile'), '_CombinedMasterFile'[5E-501] = "YES" && CONTAINSSTRING('_CombinedMasterFile'[Column1], "value1")) for each line.
No,
As with this formula, i am unable to calculate and sum the 7 variables :
Try some correct Syntax:
CALCULATE(
COUNTROWS('_CombinedMasterFile'),
FILTER(
'_CombinedMasterFile',
'_CombinedMasterFile'[6M-601] = "YES" &&
CONTAINSSTRING('_CombinedMasterFile'[Data], "6M")
)
)
think that i need to calulate the total a mount of YES in here:
You add the filter on Calculate after your expression separated by a comma.
so: CALCULATE(COUNTROWS('_CombinedMasterFile'),'_CombinedMasterFile'[5E-501] = "YES"), CONTAINSSTRING('_CombinedMasterFile'[Column1], "value1").
it is not working,
The syntax for ',' is incorrect. (DAX( CALCULATE(COUNTROWS('_CombinedMasterFile'),'_CombinedMasterFile'[6M-601] = "YES"), CONTAINSSTRING('_CombinedMasterFile'[Data], "6M"))).