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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
VIPER129MMG
Frequent Visitor

DAX - Minimo e Máximo

A fórmula abaixo trás o resultado 684,18, sendo que o mínimo é 75 e o máximo é 250 poderia me ajudar por favor?


Armazenamento =
VAR Vendas Líquidas =   [Vendas Líquidas]
VAR COGSTP =     [COGS / TP]
VAR Valor1 =
SE (
        Vendas Líquidas >= 30000 ,
        Vendas Líquidas 0,005 ,
        IF NetSales COGSTP 0,08 NetSales 0,08 )
    )
VAR Valor2 =
    SE (
        Vendas Líquidas >= 30000 ,
        Vendas Líquidas 0,005 ,
        SE Vendas Líquidas COGSTP 0,08 ) )
RETORNAR
    SE (
        [Seleção TP Venda] ,
        ,
        SE [Unit COGS / TP] ,
        SE Valor1 <= 75 75 SE Valor2 >= 250 250 Vendas Líquidas 0,08
        ))
    ))
VIPER129MMG_0-1677247572972.png

 


4 REPLIES 4
VIPER129MMG
Frequent Visitor

Fiz o que me recomendou, mas ele não se limitou ap intervalo entre 75 e 250, o resultado final continua R$ 684,18
 
Storage =
VAR NetSales =  [Net Sales]
VAR COGSTP =    [COGS / TP]
VAR Value1 =
IF (
        NetSales >= 30000,
        NetSales * 0.005,
        IF ( NetSales < 0, COGSTP * 0.08
        ,NetSales * 0.08 )
    )
VAR Value2 =
    IF (
        NetSales >= 30000,
        NetSales * 0.005,
        IF ( NetSales < 0, COGSTP * 0.08))
RETURN
    IF (
        [Seleção TP Venda] = 1,
        0,
        IF([Unit COGS / TP] = 0,0,
        IF ( Value1 <= 75,MINX(VALUES(sStorage[STORAGE]),75),
        IF ( Value2 >= 250, MAXX(VALUES  (sStorage[STORAGE]),250), NetSales * 0.08
        )
        )
    )
    )
 
VIPER129MMG_0-1677495080123.png

 

amitchandak
Super User
Super User

@VIPER129MMG , Min and max of measure based on row or group by

 

example measures

maxx(table, [Armazenamento])

 

minx(table, [Armazenamento])

 

or

 

maxx(values(table[Column]) , [Armazenamento])

 

minx(values(table[Column], [Armazenamento])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Fiz isso e não deu certo


Te mandei o link do arquivo, me salva aí amigo

https://docs.google.com/spreadsheets/d/1Da8HJHPhgnUaxHwAj7gvzyLr1fiQv3Bc/edit?usp=sharing&ouid=11219...

 

VIPER129MMG_0-1677507609839.png

VIPER129MMG_1-1677507646849.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.