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
MarceloMasson7
Frequent Visitor

Finding the Max Value of a Measure

Hi Guys,

I am a new user from BI and I have a problem to find max value from a Measure.

I have 2 Tables,
(Clients - This table contains all infomations about our client including CITY, STATE, Lat/Long, Status[This column tell me if the client is ATIVE or NOT])
(Sales - This table contains al the informations about our sales, including the ClientId, each row is a sale)

I put all my clients in a Map using the coordinates. I need to put in this map (descriptions) the number maximo of sales by each State.

Like this.

First I creat a Measure using countrows to find the number of sales by Client.

Table Sales
CODCLI | PRODUCT
1           | A
2           | A
1           | A
3           | A
1           | A
2           | A

 

Table Clients
CODCLI | STATE | CITY

1           |  MG    |  Patos de Minas
2           |  MG    |  Belo Horizonte
3           |  SP      |  São Paulo


Idependent of filter using in the map, at discription of Client 1 have to appear the MAX VALUE SALES BY STATE = 3.
At discription of Client 2: MAX VALUE SALES BY STATE = 3
At discription of Client 3: MAX VALUE SALES BY STATE = 1

I am using DIRECTQUERY, so I try get this using

Max Value = CALCULATE(MAXX(SUMMARIZE(ALL(Clientes); Clientes[CIDBairro];"contagem"; MAXX(Clientes;[Chips Vendidos Ultimos 60 dias])); [contagem]))

But its justing fiding the value maximo of sales of all clients. So in this example that i show, is like 3 for every client!

Please I need a direction!! haha
Thanks!

1 ACCEPTED SOLUTION

Hey @v-qiuyu-msft

I could solve my problem haha I used another way

I used this

 

VAR CidBairroCurrent = IF(HASONEVALUE(Clientes[codigo_cli]); FIRSTNONBLANK(Clientes[Cidade]; TRUE()))
	VAR MaximoDaReg = MAXX(FILTER(ALL(Clientes); Clientes[Cidade]=CidBairroCurrent); [Chips Comprados Ultimos 60 dias])
	var t = RANKX(FILTER(ALL(Clientes); Clientes[Cidade]=CidBairroCurrent); [Chips Comprados Ultimos 60 dias])
	return MaximoDaReg

View solution in original post

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support


Table Sales
CODCLI | PRODUCT
1           | A
2           | A
1           | A
3           | A
1           | A
2           | A

 

Table Clients
CODCLI | STATE | CITY

1           |  MG    |  Patos de Minas
2           |  MG    |  Belo Horizonte
3           |  SP      |  São Paulo


Idependent of filter using in the map, at discription of Client 1 have to appear the MAX VALUE SALES BY STATE = 3.
At discription of Client 2: MAX VALUE SALES BY STATE = 3
At discription of Client 3: MAX VALUE SALES BY STATE = 1

 


Hi @MarceloMasson7,

 

From the table structure you posted, I can't understand how you calculate the MAX VALUE SALES BY STATE. Can you share some dummy data and corresponding results for us to test?

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey @v-qiuyu-msft

I could solve my problem haha I used another way

I used this

 

VAR CidBairroCurrent = IF(HASONEVALUE(Clientes[codigo_cli]); FIRSTNONBLANK(Clientes[Cidade]; TRUE()))
	VAR MaximoDaReg = MAXX(FILTER(ALL(Clientes); Clientes[Cidade]=CidBairroCurrent); [Chips Comprados Ultimos 60 dias])
	var t = RANKX(FILTER(ALL(Clientes); Clientes[Cidade]=CidBairroCurrent); [Chips Comprados Ultimos 60 dias])
	return MaximoDaReg

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.