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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
okusai3000
Helper IV
Helper IV

Issues with Totals of a Table and Visual Card

Hi everyone,

 

I'm contacting you because I have an issue with this measure:

 

*PRUEBA ADH =

VAR MaxDate=max('dim Fecha'[Fecha])

RETURN

CALCULATE(

    CALCULATE([*Tratamientos Activos],

    'fact Visitas'[Id Tipo Visita]<>"I",

  filter('fact Prescripciones',[*Cumple_No_Cumple]="Cumple"),

    'fact Visitas'[Dias entre visitas (Atributo)]<>0),

    filter(ALL('dim Fecha'),'dim Fecha'[Fecha]<=MaxDate),

    filter(ALLSELECTED('fact Prescripciones'),'a Measures ET'[*Tratamientos Activos]=1))

 
It works perfectly fine , as long as inside of a table with the column "prescription_ID" and the measure = 1.
 
On the other hand, when I put it inside of a visual card, I get just a 0, and not the total.
 
I understand that I must figure it out a new measure using Summarize; filter and Sumx, but I'm failing...
 
Any ideas?
 
Thanks a lot!
 
 
 
 
3 REPLIES 3
okusai3000
Helper IV
Helper IV

hi @Greg_Deckler !

 

It's a pitty but those links didn't help me. I'll be glad to try to explain it again:

 

We have this measure:

*PRUEBA ADH =

VAR MaxDate=max('dim Fecha'[Fecha])

RETURN

CALCULATE(
    CALCULATE([*Tratamientos Activos],
        'fact Visitas'[Id Tipo Visita]<>"I",
         filter('fact Prescripciones',[*Cumple_No_Cumple]="Cumple"),
         'fact Visitas'[Dias entre visitas (Atributo)]<>0),
         filter(ALL('dim Fecha'),'dim Fecha'[Fecha]<=MaxDate),
    filter(ALLSELECTED('fact Prescripciones'),'a Measures ET'[*Tratamientos Activos]=1))
 
Works simply fine. Inserted in a table, it shows for every single medical prescription, a 1 if they accomplished the results, or a 0 if not. The sum total, also is correct and it's only showed in a table if we put as a filter this previous measure=1.
 
So, the problem is that I need to use that total in visual cards, percentage, etc, and If I use it straight, it just shows a 0.
 
I need to build a Measure that would recreate the table WITH the FILTER of itself = 1, and then get the total.
 
I've tried with Summarize; Calculatetable (to get the filters) and finally SUMX but still I can't make it work.
 
Is it more clear?
 
thanks a lot!
 

 

@okusai3000 It's perfectly clear but see the second part of the post. Need sample data and expected output to recreate it, otherwise it is next to impossible to help you out.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@okusai3000 This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

If that doesn't help, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.