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

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.

Reply
Kumarcy
Helper II
Helper II

dax measure help

Hi Power Users,

 

I'm new to power bi and learning. I'm trying to move tableau dash boards to power bi and struck with one measure.

Tableau Measure

CASE [Business Unit]
    WHEN "ABC" THEN (IF([Date] > TODAY()) THEN FALSE
                            ELSE TRUE
                           END)
    WHEN "CDE" THEN (IF([Date] > TODAY()) THEN FALSE
                            ELSE TRUE
                           END)
END

 

This measuew specifies if events are scheduled for future dates.

 

I need convert this measure to DAX.

 

Please help.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

Create a calculated column using this below code.

 

Column = IF([Business Unit] = "ABC", IF(VALUE([DATE]) > VALUE(TODAY()),"FALSE","TRUE"),IF('Table'[Business Unit]="CDE",IF(VALUE([DATE]) > VALUE(TODAY()),"FALSE","TRUE")))
 
or 
 
Column 2 = SWITCH([Business Unit],
"ABC",IF(VALUE([Date]) > VALUE(TODAY()),FALSE(),TRUE()),
"CDE",IF(VALUE([Date]) >VALUE(TODAY()),FALSE(),TRUE())
)
 
Did I answer your question? If Yes, Give me a Kudo
 

View solution in original post

4 REPLIES 4
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Kumarcy -

Try

 

Measure =
SWITCH (
    SELECTEDVALUE ( TableName[Business Unit] ),
    "ABC", IF ( SELECTEDVALUE ( TableName[Date] ) > TODAY (), FALSE(), TRUE() ),
    "CDE", IF ( SELECTEDVALUE ( TableName[Date] ) > TODAY (), FALSE(), TRUE() ),
    -1
)

image.png

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Sorry, I didn't inform earlier that the business unit feild is in separate table and that business unit as a slicer. when user select the business unit then i need to create sepate column and that column i need to use as slicer. 

Anonymous
Not applicable

Hi,

 

Create a calculated column using this below code.

 

Column = IF([Business Unit] = "ABC", IF(VALUE([DATE]) > VALUE(TODAY()),"FALSE","TRUE"),IF('Table'[Business Unit]="CDE",IF(VALUE([DATE]) > VALUE(TODAY()),"FALSE","TRUE")))
 
or 
 
Column 2 = SWITCH([Business Unit],
"ABC",IF(VALUE([Date]) > VALUE(TODAY()),FALSE(),TRUE()),
"CDE",IF(VALUE([Date]) >VALUE(TODAY()),FALSE(),TRUE())
)
 
Did I answer your question? If Yes, Give me a Kudo
 
Greg_Deckler
Super User
Super User

Should be something like:

SWITCH([Business Unit],
    "ABC",IF([Date] > TODAY(),FALSE(),TRUE()),
    "CDE",IF([Date] > TODAY(),FALSE(),TRUE())
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.