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

IN vs Out per day

Hi community,

I have the following challenge:

 

With a dataset like this:

 

AvisoDate INDate OutTexto código del problema
30505001502/03/201802/03/2018Plataforma telefónica
30518399002/03/201803/03/2018Buzón de correo electrónico
30518399102/03/201803/03/2018Plataforma telefónica
30518399202/03/201805/03/2018Plataforma telefónica
30518399302/03/2018 Plataforma telefónica
30518399404/03/201807/03/2018Plataforma telefónica
30518400505/06/2018 Plataforma telefónica

 

I need to create a Slicer showing:

-Number of "Avisos" per Date IN.

-Number of "Avisos" per Date OUT.

-Accumulative number of "Avisos" IN per day.

-Accumulative number of "Avisos" OUT per day.

-Difference between Accumulative number of Avisos IN and OUT.

 

Thank you in advance.

1 ACCEPTED SOLUTION

Hi Alex,

 

First in the edit query unpivot Date IN & Date OUT column, which will result in the below table:

 

T1.JPG

 

Then make a summarised columns which only contains date:

Date = SUMMARIZE(Table1,Table1[Value])

 

Link this table and the main table on value (Date column)

 

Make two columns for date in & out count:

 

IN = CALCULATE(COUNT(Table1[Attribute]),Table1[Attribute]="DATE In") 

OUT = CALCULATE(COUNT(Table1[Attribute]),Table1[Attribute]="DATE OUT")

 

T2.JPG

 

Finally create two measures for running total and then take the difference for the last column.

 

IN running total in Value =
CALCULATE(
SUM('Date'[IN]),
FILTER(
ALLSELECTED('Date'[Value]),
ISONORAFTER('Date'[Value], MAX('Date'[Value]), DESC)
)
)

 

OUT running total in Value =
CALCULATE(
SUM('Date'[OUT]),
FILTER(
ALLSELECTED('Date'[Value]),
ISONORAFTER('Date'[Value], MAX('Date'[Value]), DESC)
)
)

 

Difference = [OUT running total in Value]-[IN running total in Value]

 

T3.JPG

Regards,

Saurabh Kedia

View solution in original post

4 REPLIES 4
v-yuezhe-msft
Employee
Employee

@ALEX13,

Could you please describe more details about your scenario? What field do you use to create slicer?

For those blank Date Out values, how do you display the number and accumulative numbers of "Avisos"? Moreover, about the last requirement (Difference between Accumulative number of Avisos IN and OUT), what data would you like to show?

Regards,

Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Please tell me if you need more details.

thank you very much in advance.

Hi Alex,

 

First in the edit query unpivot Date IN & Date OUT column, which will result in the below table:

 

T1.JPG

 

Then make a summarised columns which only contains date:

Date = SUMMARIZE(Table1,Table1[Value])

 

Link this table and the main table on value (Date column)

 

Make two columns for date in & out count:

 

IN = CALCULATE(COUNT(Table1[Attribute]),Table1[Attribute]="DATE In") 

OUT = CALCULATE(COUNT(Table1[Attribute]),Table1[Attribute]="DATE OUT")

 

T2.JPG

 

Finally create two measures for running total and then take the difference for the last column.

 

IN running total in Value =
CALCULATE(
SUM('Date'[IN]),
FILTER(
ALLSELECTED('Date'[Value]),
ISONORAFTER('Date'[Value], MAX('Date'[Value]), DESC)
)
)

 

OUT running total in Value =
CALCULATE(
SUM('Date'[OUT]),
FILTER(
ALLSELECTED('Date'[Value]),
ISONORAFTER('Date'[Value], MAX('Date'[Value]), DESC)
)
)

 

Difference = [OUT running total in Value]-[IN running total in Value]

 

T3.JPG

Regards,

Saurabh Kedia

@v-yuezhe-msft

HI Lydia,

 

I would like to obtain the following result:

 

 INOUTAccumulative INAccumulative OUTDifference (Accumulative)
02/03/20185151-4
03/03/2018 253-2
04/03/20181 63-3
05/03/20181174-3
07/03/2018 175-2

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.