Forum Discussion
Subtract between 2 cards
good morning, I hope you are well. I am new to power bi and I am a bit husky. I need to make a subtraction between 2 cards so that the result goes to another card, is that possible ?.
13 Replies
- goncalogeraldesSuper User
Hello there Byakko089 ! You can store the value of the two cards in separate measures. To create a measure just go to the "Home" tab and select "New measure".
To then use these two to create a third measure for the substraction, like so:
Measure 1 = SUM(Table[Column1 to add])And:
Measure 2 = SUM(Table[Column2 to add])And then subtract the two:
Measure 3 = [Measure 1] - [Measure 2]Alternatively you can do it all in one measure:
Subtraction = var _1 = SUM(Table[Column1 to add]) var _2 = SUM(Table[Column2 to add]) return _1 - _2Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes- Byakko089Regular Visitor
1) I thank you for the prompt response and for the data. I had seen that yes, I can use the measure to create what I wanted to do, but I found the problem that I already have filters in place on the cards to be able to provide me with certain specific data on card 1 and on card 2 other specific data (Photo) . Could you explain to me how to measure, I can replicate the filters?
because I thought that I could call the card, but I see that no, that what is called is always the fields.
- goncalogeraldesSuper User
Hello there Byakko089 ! Check if the following works for you:
Measure = CALCULATE( SUM( Table[Column] ), FILTER( Table, Table[DesComprob] <> "NC de Crédito" && Table[DescrMdaOper] = "Dolares" && MONTH(Table[Fecha MESES]) = MONTH( TODAY() ) ) )Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
- Byakko089Regular Visitor
Hello goncalogeraldes , good afternoon, how are you doing? I hope you are well.
I tried to run the measurement as you passed it to me but it leaves it blank.
I made the following measurement
Medida = CALCULATE(SUM(FE_Impresion_FacturaCab[Subtotal]),FILTER(FE_Impresion_FacturaCab,FE_Impresion_FacturaCab[DesComprob]<> "Factura Elect A" && FE_Impresion_FacturaCab[DesComprob]<> "FCE Cred A MiPyMes" && FE_Impresion_FacturaCab[DesComprob]<> "ND Elect A" && FE_Impresion_FacturaCab[Fecha MESES] = MONTH( TODAY())))
when I see date month, it throws it to me as 01/10 / year and that way the sql table searches for all the information.Making a table by hand with the filters, it shows me all the information, I send you a capture of the filter that if it works, I would need to replicate it as a measure, so then I can do the subtraction between the 2 measures.
And in addition to this I ask you, did it ever happen to you that capturing data in power bi, is there some data that does not link / import them? Because it happens to me that in the system from where I bring the information, there are 4 items that do appear, but the power bi does not bring it and I had to check by hand which of the entire list were the billing items that did not appear.
- AlexisOlsonSuper User
MONTH returns a number between 1 and 12, which doesn't match the datetime data type of [Fecha MESES].
This might work:
Medida = CALCULATE ( SUM ( FE_Impresion_FacturaCab[Subtotal] ), FILTER ( FE_Impresion_FacturaCab, FE_Impresion_FacturaCab[DesComprob] <> "Factura Elect A" && FE_Impresion_FacturaCab[DesComprob] <> "FCE Cred A MiPyMes" && FE_Impresion_FacturaCab[DesComprob] <> "ND Elect A" && MONTH ( FE_Impresion_FacturaCab[Fecha MESES] ) = MONTH ( TODAY () ) ) )
- Byakko089Regular Visitor
Hello goncalogeraldes y AlexisOlson Excuse me to bother you again. But could you if it's not too much to ask of you, help me finish solving this puzzle. Because with the tips that they threw at me, I did not end up with the metric walking?