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
Shiroe
Helper I
Helper I

Calculate a total within a single measure

Dear partners,

 

I am writing requesting your assistance again, I need to calculate a total within a single measure keeping a static cumulative for a division. Individually, as you can see below, each measurement works separately for me, but when trying to perform the entire calculation in a single measurement, the variables do not offer me the same result.

 

ind_azul_%ventanilla=CALCULATE(SUM(MEDIDA),CAMPO3*60 <30, CAMPO1="CAMPO1",CAMPO2="CAMPO2")

 

total_vales_ventanilla= CALCULATE(SUM(MEDIDA),FILTER(ALL(CALENDAR)),CALENDAR), AND(CAMPO1=''CAMPO1',CAMPO2="CAMPO2"))

 

División  = ind_azul_%ventanilla/total_vales_ventanilla

 

I need all the calculations to remain in a single measure, the result being the field that I call division in the table that you see

 

1.JPG

 

I thank you in advance for your help

 

 

Regards

 

1 ACCEPTED SOLUTION

I record the solution only finally leave the formula like this and the problem is solved. I hope it helps someone else

 

Measure =
DIVIDE(
    CALCULATE(SUM(MEDIDA),CAMPO3*60 <30, CAMPO1="CAMPO1",CAMPO2="CAMPO2"),
    CALCULATE(SUM(MEDIDA),FILTER(ALL(CALENDAR)),CALENDAR), AND(CAMPO1=''CAMPO1',CAMPO2="CAMPO2"))
  )

 

 

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Shiroe Perhaps try:

Measure =
  IF(
    HASONEVALUE('Table'[Date],
    CALCULATE(SUM(MEDIDA),CAMPO3*60 <30, CAMPO1="CAMPO1",CAMPO2="CAMPO2"),
    CALCULATE(SUM(MEDIDA),FILTER(ALL(CALENDAR)),CALENDAR), AND(CAMPO1=''CAMPO1',CAMPO2="CAMPO2"))
  )

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Partner, it worked !! but now it no longer shows me the total of the column that corresponds to that measure. any ideas?😥

2.JPG

 

I record the solution only finally leave the formula like this and the problem is solved. I hope it helps someone else

 

Measure =
DIVIDE(
    CALCULATE(SUM(MEDIDA),CAMPO3*60 <30, CAMPO1="CAMPO1",CAMPO2="CAMPO2"),
    CALCULATE(SUM(MEDIDA),FILTER(ALL(CALENDAR)),CALENDAR), AND(CAMPO1=''CAMPO1',CAMPO2="CAMPO2"))
  )

 

 

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.