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
selpaqm
Helper V
Helper V

earlier function combine with other columns

Hi,

 

I have a table as below. 

Column uses 

"Column =
VAR _count= CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[salesman/country]=EARLIER('Table'[salesman/country])&&'Table'[Index]>=EARLIER('Table'[Index])))
VAR _count2=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[salesman/country]=EARLIER('Table'[salesman/country])))
return if(_count=_count2,1,0)"

selpaqm_0-1599826044676.png

selpaqm_1-1599826068491.png

however, in case of method a and b is for same country and salesman need to be written as mixed.

as an example updated method column should be as below.

Capture.PNG

below you may find the related pbix file

example.pbix 

 

1 ACCEPTED SOLUTION

@selpaqm , refer this can work as a new column

Column =
VAR _count= CALCULATE(DistinctCount([Method]) ,FILTER('Table','Table'[salesman/country]=EARLIER('Table'[salesman/country])))+0
return if(_count>1,"Mixed", [method])

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@selpaqm First, DAX Formatter is your friend: https://www.daxformatter.com/

 

Column =
  VAR __Table = 
    SUMMARIZE(
        FILTER (
            'Table',
            'Table'[salesman/country] = EARLIER ( 'Table'[salesman/country] ),
            [method]
        )
RETURN
    IF ( COUNTROWS(__Table>1, "mixed", MAXX(__Table,[method]) )

If not, share data as text in a table please. 

  


@ 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...

hi @Greg_Deckler 

unfortunately, taken error.

 

Example.pbix 

at above link you may find my find pbix file.

 

Regards,

@selpaqm , refer this can work as a new column

Column =
VAR _count= CALCULATE(DistinctCount([Method]) ,FILTER('Table','Table'[salesman/country]=EARLIER('Table'[salesman/country])))+0
return if(_count>1,"Mixed", [method])

@selpaqm No access to that file


@ 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...

@Greg_Deckler 

can you please retry it.exampl.pbix 

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.