cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Amitkr174
Helper II
Helper II

Need help on DAX

DAX.PNGHi,

 

I need some help with DAX. Below is the DAX code which I am using to derive the backlog type.

This DAX is working fine but the issue is that at the total level I am seeing 'Bill in advance' (highlighted in yellow) which I want to remove. Please suggest something on this.

 

Backlog Type =
IF(LASTNONBLANK('ADLS Backlog'[Product],1)=BLANK(),BLANK(),
IF(SEARCH("TBE",LASTNONBLANK('ADLS Backlog'[Product],1),1,0),"Bill in Arrears", "Bill in Advance"))
 

 

2 ACCEPTED SOLUTIONS
MoOv
Resolver II
Resolver II

You could add something like "IF( HASONEVALUE( Table[Deal Registration ID] ), [[your measure]], BLANK() )". Since you have more than one value for this column on the total level, but a single value for each row of your visual, this should return the same values in each row and no value on the total level.


Regards

 

View solution in original post

MFelix
Super User
Super User

Hi @Amitkr174 ,

 

Measure are based on context so when you add a measure to a table/matrix the value is still calculated on the last row, depending on the values you have for aggregations the result can be different.

 

You can change your measure to:

Backlog Type =
IF (
    HASONEVALUE ( Table[Geo] ),
    IF (
        LASTNONBLANK ( 'ADLS Backlog'[Product], 1 ) = BLANK (),
        BLANK (),
        IF (
            SEARCH ( "TBE", LASTNONBLANK ( 'ADLS Backlog'[Product], 1 ), 1, 0 ),
            "Bill in Arrears",
            "Bill in Advance"
        )
    ),
    BLANK ()
)

You need to replace the Table[Geo] by the name of the table where the column Geo is located, you can also use any other column on your table, the idea is that if theres is a single value for geo it returns your meausre other wise is blank.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Amitkr174 ,

 

Measure are based on context so when you add a measure to a table/matrix the value is still calculated on the last row, depending on the values you have for aggregations the result can be different.

 

You can change your measure to:

Backlog Type =
IF (
    HASONEVALUE ( Table[Geo] ),
    IF (
        LASTNONBLANK ( 'ADLS Backlog'[Product], 1 ) = BLANK (),
        BLANK (),
        IF (
            SEARCH ( "TBE", LASTNONBLANK ( 'ADLS Backlog'[Product], 1 ), 1, 0 ),
            "Bill in Arrears",
            "Bill in Advance"
        )
    ),
    BLANK ()
)

You need to replace the Table[Geo] by the name of the table where the column Geo is located, you can also use any other column on your table, the idea is that if theres is a single value for geo it returns your meausre other wise is blank.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you so much for the help!

 

Below DAX is working fine :-

 

ADLS Backlog Type =
IF(HASONEVALUE('ADLS Backlog'[Product]),
      IF(SEARCH("TBE",LASTNONBLANK('ADLS Backlog'[Product],1),1,0),"Bill in Arrears", "Bill in Advance"),
        BLANK()
   )
 

 

MoOv
Resolver II
Resolver II

You could add something like "IF( HASONEVALUE( Table[Deal Registration ID] ), [[your measure]], BLANK() )". Since you have more than one value for this column on the total level, but a single value for each row of your visual, this should return the same values in each row and no value on the total level.


Regards

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors