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
Alka735
Frequent Visitor

Count of Users with checked condition 1 and zero

Hi all,
"Count of Users which are active last month ie have some sale value but inactive this month ie their sale is zero or blank"

Firstly , i have calculated measure for "active users last month sales volume" and "active users this month sales volume " seperately
and make a flag measure to meet my condition using IF such that (active users last month sales volume>0 && active users this month sales volume=0 ) which gives me 1 when the condition satisfied otherwise 0 .

So i have need to count or sum these "1" value obtained from flag measure.

ThanksCount.png

7 REPLIES 7
Alka735
Frequent Visitor

Hii,

Thanks for providing this measure but this is not working in my case .
here are the measures which i am trying to find in my case ,Firstly

I have created these measure s image (6).pngsuch that 
------------------------------------------------------------------------------------------
Total active users volume this month = CALCULATE ( SUM(DATA[Sale]), DATEADD ( Calendar[Date], 0, MONTH )
Last Month active users Volume = CALCULATE ( SUM(DATA[Sale]), DATEADD ( Calendar[Date], -1, MONTH )
FlagMeasure = IF([Total active users volume this month]=BLANK() && [Last Month active users Volume]>0,1 ,0)

-------------------------------------------------------------------------------------------
and visualise these measure in matrix on the basis of users.
Now, i have need to count users for which the flag measure has value 1 

UsersFebMarch
1250 
2 40
3220 
47082
585210
611550
7135 
84098
9320104
10 65
11 10
12 60
13 70
22270 
23 100
24 60
33 20
3420065
45 120
776517
78 25

@Alka735 See the attached file where I have created the test data based on your request, the first thing you need is to create a simple table of Active and  NotActive

DimaMD_1-1685435006490.png

 

Then use this measure to count customers

 

 

Customers Count = 
VAR _CustomerSegments =
ADDCOLUMNS(
	VALUES('table'[Users]),
	"Segment", [FlagM]
	)
VAR _SegmentCustomerCount =
GROUPBY(
	_CustomerSegments,
	[Segment],
	"# Customers", COUNTX ( CURRENTGROUP (), 1 )
	)
VAR _Result = 
FILTER(
    _SegmentCustomerCount,
    [Segment] = SELECTEDVALUE('ActiveUsers'[Value])
)
RETURN
MAXX(
    _Result,
    [# Customers]
    )

 

 

It is a pity that you did not provide more extensive data for testing, but try what I have given you and tell me about the result

DimaMD_2-1685435065383.png

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

hi,

thanks for the solution but i am sharing measures on which i working.

I want to count the flag measure which has value 1 based on my condition but it is giving me blank value or incorrect value and need to work it for all the slicers.
here are measures----

Last Month Users Volume = CALCULATE(SUM('Table'[Sale]),DATEADD(Calender[Date],-1,MONTH))
This Month Users Volume = CALCULATE(SUM('Table'[Sale]),DATEADD(Calender[Date],0,MONTH))
Flag Measure = IF([Last Month Users Volume]<>0 && [This Month Users Volume]=BLANK(),1,0)
User_Count =
SUMX(
    VALUES('Table'[Users]),
    IF([Flag Measure]=1,1,0 )
)

Thanks

abcd.png

DateUsersSale
30-01-20232640620
13-03-2023546320
30-01-2023546320
18-04-2023291425
18-04-2023289235
16-04-202313421201
18-01-202355560
30-04-202318543205
28-02-20232319010
01-04-20232651560
16-03-20236781
15-03-20231350150
04-04-20231324330
05-04-2023987610
07-01-202323446
06-03-2023134544
18-04-2023777250
24-02-202335218102
07-02-202323488
04-01-202323430
29-03-202321465300
26-03-202321465200
10-01-20231987910
26-04-2023134545
11-04-2023134545
03-04-2023134528
28-03-2023134532
24-03-2023134535
18-03-2023134535
18-01-202328141150
28-02-202328226150
31-01-202333681250
28-01-20231517540
19-04-20233019630
28-04-20232557435
24-03-2023901300
01-03-20232053530
01-03-20232053530
28-02-20233024560
25-03-20233457310
11-02-2023245030
28-04-20233553360
18-01-20233006730
03-04-2023207835
16-01-202316234200
30-04-2023123410
30-04-2023134510
01-03-2023106630
17-04-202325605150
26-04-2023106641
27-03-202355251
13-04-20233463085
13-01-202316599200
14-03-20231620827
24-03-20238470130
19-01-20232876890
25-03-20231403110
25-03-20231429130
16-03-20231440225
16-03-20231433625
10-04-202330173400
20-04-202334545
16-02-20233046745
06-02-2023315445
16-02-2023494960
16-02-2023494960
24-04-2023515340
21-04-202323435
22-03-202334510
05-03-202334530
13-02-202389262
06-01-20231380175
30-04-2023901200
30-04-2023901200
08-02-2023138102
09-01-202376530
10-03-2023283135
04-02-2023135830
24-02-202345512
23-03-202319312
10-03-202326437200
25-03-202345630
19-02-2023672062
06-04-2023283310
13-01-2023311630
26-03-20231236960
31-03-20231255810
17-03-20231280210
27-03-2023361780
01-02-2023134545
12-02-2023134535
02-03-2023134554
12-03-2023134552
17-04-2023134535
28-02-2023134535
07-02-2023134538
04-02-202345666655
05-03-2023500120
12-02-20232726725
18-01-20232726725






Alka735
Frequent Visitor

Hi,
Thanks for response
here is the sample data for testing.

UsersSaleMonth
12502
22202
2403
3302
4453
4123
51003
6303
7802
77652
78253
5803
451203
3802
4252
31002
4452
6203
7552
8983
91043
10653
91202
11103
12603
13703
24603
342002
33203
231003
3102
5852
61152
92002
8402
77173
222502
34653
4253
5303

@Alka735  Hi, try it 

Total = Sumx( Values('Table'[USERS]),[#FlagMeasure])

or

= IF ( HASONEVALUE( 'Table[USERS]),
[#FlagMeasure],
SUMX(VALUES('Table[USERS]),
[#FlagMeasure]
)

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

@Alka735 What measure do you use for Flag, in the example you don't have 0 sales


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
DimaMD
Solution Sage
Solution Sage

@Alka735 Can you provide sample data for testing?

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

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.

Top Solution Authors