Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX Calculate help

Hi,

 

I am wanting to use the following DAX code to retreive Values based on INET titles.

 

However it is returning nothing... Have I formulated the DAX correctly?

 

Thanks.

 

PrintDigital = CALCULATE([NoOfAds],titles[mediatype]="INET",userDefs[adoper] <> "BA430" 
&& userDefs[adoper] <> "CA148" 
&& userDefs[adoper] <> "HX355" && userDefs[adoper] <> "MD301", titles[ttlcode] = "WCNE" && titles[ttlcode] = "WHEX" && titles[ttlcode] = "WNST" && titles[ttlcode] = "WNWE" && titles[ttlcode] = "WTST" && titles[ttlcode] = "WWHA" )
2 REPLIES 2
mattbrice
Solution Sage
Solution Sage

First comment is if you use the "IN" operator, code is a bit easier to read:

 

PrintDigital =
CALCULATE (
    [NoOfAds],
    titles[mediatype] = "INET",
    NOT ( userDefs[adoper] IN { "BA430", "CA148", "HX355", "MD301" } ),
    titles[ttlcode] IN { "WCNE", "WHEX", "WNST", "WNWE", "WTST", "WWHA" }
)

Second comment is keep in mind the individual setfilter arguments to CALCULATE  are "AND" together.  Your filters together read Return [NoOfAd] where mediatype = INET and adoper not one of the values listed and ttlcode is one of the values you listed.  If all need to be true, you may be filtering out all the values in table.

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Are you using the formula to create a measure or calculate column?

 

Is there any relationship between your "titles" table and "userDefs" table? What's the formula of measure[NoOfAds]?

 

Could you post your table structures with some sample data and your expected result, so that we can better assist on this issue? Smiley Happy

 

Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.