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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NewbieJono
Post Patron
Post Patron

IF and AND

Hello i am trying to put some code in to check

 

if MAX date from date table = Today(), 

AND Group = "Mail"

 

Then

 

"Data Available"

 

Else

 

Data Not Available

 

any ideas?

1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

Hi,

 

there's some information missing (e.g. where is the Group-Column and how is the table connected to the date table?) but assuming there's a fact table with a Date which is linked to the Date column in your Date table and a Column Group which can have the value "Mail" this should do the trick. You can add it to a card for example.

VAR isAvailable =
   CALCULATE(
       MAX(dateTable[Date]),
       yourOtherTable[Group] = "Mail"
   ) = TODAY()

RETURN
   IF(isAvailable, "Data Available", "Data Not Available")
    

 

View solution in original post

5 REPLIES 5
lukiz84
Memorable Member
Memorable Member

Hi,

 

there's some information missing (e.g. where is the Group-Column and how is the table connected to the date table?) but assuming there's a fact table with a Date which is linked to the Date column in your Date table and a Column Group which can have the value "Mail" this should do the trick. You can add it to a card for example.

VAR isAvailable =
   CALCULATE(
       MAX(dateTable[Date]),
       yourOtherTable[Group] = "Mail"
   ) = TODAY()

RETURN
   IF(isAvailable, "Data Available", "Data Not Available")
    

 

This don't seem to work, the data is all in one table

 

Mail isAvailable = 

VAR isAvailable =
   CALCULATE(
       MAX('FACT - TEST'[Date]),
       'FACT - TEST'[Grouping] = "Mail Opening"
   ) = TODAY()

RETURN

   IF(isAvailable, "Data Available", "Data Not Available")

Do you have any more infos? What does the measure return?

pranit828
Community Champion
Community Champion

Hi @NewbieJono 

Try

if(MAX('table'[date] = Today() && 'table'[Group] = "Mail","Data Available","Data Not Available")




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

on this  after the && it will not let me select a table here, only measures

 

if(MAX('table'[date] = Today() && 'table'[Group] = "Mail","Data Available","Data Not Available")

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.