Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
OLÁ,
Tenho o seguinte caso:
Tabela vendas:
- Meta Alcançável (é a o quanto da meta já deveria ter sido alcançado -- Meta / Dias úteis * Dias Passados)
- Dias Úteis (Medida calculada a partir de uma tabela data)
- Dias passados (Medida -- Dias úteis - Dias úteis restantes )
Tabela Lojas:
- Número da loja (chave da relação entre as tabelas)
- Abre final de semana (Sim ou Não)
Preciso fazer um cálculo da medida META ALCANÇÁVEL, mas se caso um valor específico de outra tabela esteja sendo selecionado, o cálculo no visual leve em consideração outra condição de dias, isso porque nem todas as lojas abrem somente em dias úteis, mas sim todos os dias.
Por exemplo, tenho um gráfico de barras e no valor da META ALCANÇÁVEL da LOJA X, que não abre final de semana e possui na tabela Lojas o campo ABRE FINAL DE SEMANA como Sim, o ideal seria em vez dos dias úteis o total de dias do mês atual e nos dias passados atuais do relatório.
META ALCANÇÁVEL = META / TOTAL DE DIAS DO MÊS ATUAL * DIAS PASSADOS ATUAIS
Seguem os dados em Link:
https://drive.google.com/drive/folders/1ohkzA_ocKKAbymZNCXtJ2q3nupCjXBo9?usp=sharing
Exemplo de um resultado esperado:
No caso da Loja 5 uma das que abrem todos os dias, o cálculo seria:
Meta - R$350.000
Dias Úteis - 31 (Nesse caso são os totais de dias do mês de outubro)
Dias Passados - 24 (dia dessa mensagem, mas no cálculo seria uma função Today, provavelmente)
META ALCANÇÁVEL = META / TOTAL DE DIAS DO MÊS ATUAL * DIAS PASSADOS ATUAIS
META ALCANÇÁVEL = 350.000/ 31 * 24
META ALCANÇÁVEL = 270967,74
Hi @mottamatheus835,
You can add an if statement to your formula with isfiltered function to check if the specific field has been filtered. Then you can parameterized the calculation formula with the different expressions to achieve dynamic switch formulas based on filter effects.
ISFILTERED, ISCROSSFILTERED – DAX Guide - SQLBI
Regards,
Xiaoxin Sheng
Hi @Anonymous . I tested, but for what I want it doesn't work. I need to make the IF function see the specific fields that are been filtered. The entire column will give me a wrong Meta Alcançável.
HI @mottamatheus835,
Can you please share the formula and expected result? They should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |