Forum Discussion
Subtract and get less previous current date quantity
Hello powerbi community, cordial greeting.
Again I am here to ask for support, I am needing to create a new calculated column that brings me the difference that exists between the minor date and the next date of people.
For example: If on 26/03/2020 I have 5 people, then the difference against the previous date which is 19/03/2020 is 2. Because the 5 - 3 = 2 is subtracted.
Attached example image, result to get column Dif_por_dia.
In advance thank you very much always for your support.
Cordially
Wolter
Hi,
I tried to create similar sample data like below.
Please check the below picture and the attached pbix file.
Dif_por_dia CC =VAR currentdatevalue = Data[Cantidad_Personas]VAR currentdate = Data[Date]VAR previousdate =MAXX ( FILTER ( Data, Data[Date] < currentdate ), Data[Date] )VAR previousdatevalue =MAXX ( FILTER ( Data, Data[Date] = previousdate ), Data[Cantidad_Personas] )RETURNcurrentdatevalue - previousdatevalue
2 Replies
- Syndicate_Admin
Administrator
Thank you very much, it worked perfectly.
- Jihwan_Kim
Super User
Hi,
I tried to create similar sample data like below.
Please check the below picture and the attached pbix file.
Dif_por_dia CC =VAR currentdatevalue = Data[Cantidad_Personas]VAR currentdate = Data[Date]VAR previousdate =MAXX ( FILTER ( Data, Data[Date] < currentdate ), Data[Date] )VAR previousdatevalue =MAXX ( FILTER ( Data, Data[Date] = previousdate ), Data[Cantidad_Personas] )RETURNcurrentdatevalue - previousdatevalue