cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Summarize ranked sales

Hi Community!

 

I'm having trouble trying to perform a measure. I need tu summarize sales with sepecific conditions. The conditions are: Sum sales that are more or equal than 1 million and that the sales rank is above 30.

 

The measure that I imagine is something like this:

Ventas Marcas Emergentes +1M = 
CALCULATE(
    'Medidas VentasMPh'[Ventas];
    GROUPBY(
        'Marca';
        'Marca'[Leading Brands]
    );
    FILTER(
        'Medidas VentasMPh';
        'Medidas VentasMPh'[Ventas] >= 1000000
    );
    FILTER(
        'Medidas VentasMPh';
        'Medidas VentasMPh'[Ranking Leading Brand por Ventas] > 30
    )
)

What I notice is the second filter of the rank is not working.

 

The rank measure is:

Ranking Leading Brand por Ventas = 
/* Se rankea Leading Brand por la medida de Ventas (responde al selector de período YTD,MTH,MAT) */

IF(
	'Medidas VentasMPh'[Ventas] <> 0;
	RANKX(
		ALLSELECTED('Marca'[Leading Brands]);
		'Medidas VentasMPh'[Ventas]
	)
)

This rank measure works fine when using in a table with Leading Brands.

 

What should I change to make this work?

 

Thanks in advance.

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Summarize ranked sales

Hi @hfoth,

 

Can you share a dummy sample? 

How about function Summarize? Is [Ventas] a measure or a column?

 

Best Regards,

Dale

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

Re: Summarize ranked sales

Hi @v-jiascu-msft.

 

[Ventas] is a measure:

Ventas = 
SWITCH(
	VALUES(
		'Selector Período'[Período]
	);
	"YTD";
	CALCULATE(
		SUM(
			'Ventas Mensuales'[USD]
		);
		DATESYTD(
			'Período a Analizar'[Fecha]
		);
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
	);
	"MTH";
    CALCULATE(
        SUM(
            'Ventas Mensuales'[USD]
        );
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
    );
	"MAT";
	CALCULATE(
		SUM(
			'Ventas Mensuales'[USD]
		);
		DATESINPERIOD(
			'Período a Analizar'[Fecha];
			LASTDATE(
				'Período a Analizar'[Fecha]
			);
			-1;
			YEAR
		);
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
	)
)

 

Does this help to clarify the situation?

 

Thanks in advance.

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors