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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

DAX Help needed

I have dashboard which has different DAX . One of the DAX is IF ELSE condition ,also has silcer on top of it.

 

The intial values are ( 1,2) when flag applied as "No" . and there are cerntain values  changing from "1" to "2" after applying flag as "Yes".

I have been applying conditional formatating /Icons ( RED ,GREEN). Similarly have do highlight as "AMBER " the values those changing "1" to "2" after applying flag as "Yes"

 

Example:

 

Data Flag.jpg

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Knidly check if the attachment is what you want.

Measure =
SWITCH (
    SELECTEDVALUE ( Flag[Flag] ),
    "No", SUM ( 'Table'[Value] ),
    "Yes",
        IF (
            SELECTEDVALUE ( 'Table'[Dimension] ) IN { "A", "C" },
            2,
            SUM ( 'Table'[Value] )
        )
)

flag.gif

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Knidly check if the attachment is what you want.

Measure =
SWITCH (
    SELECTEDVALUE ( Flag[Flag] ),
    "No", SUM ( 'Table'[Value] ),
    "Yes",
        IF (
            SELECTEDVALUE ( 'Table'[Dimension] ) IN { "A", "C" },
            2,
            SUM ( 'Table'[Value] )
        )
)

flag.gif

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@Anonymous - I am not quite following this. Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


Follow on LinkedIn
@ 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...
amitchandak
Super User
Super User

@Anonymous , Your measure is not very clear. But you can create a color measure and use that with Conditional formatting after choosing the "Field Value" option

Colour = 
SWITCH(TRUE(),
Table[Date] < TODAY(), "red",
Table[Date] = TODAY(), "orange",
"green")

Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK(Table[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

Check

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.