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
Anonymous
Not applicable

How to Count Conditional Visual Column based on DAX

Hi All,

I have cummulative perecnetages driven by DAX in term of context transition. On that percentages i have applied condition by AA,A,C & D which is working correctly , now i want count how many AA , A, B C & D , Could you please assist. 

 

All measures calculated based on DAX

 

% of Cummulative Total = DIVIDE([Cummulative total],[sum of total orders by SKU])

 

 

Class by cumm % = if(
NOT(ISBLANK([% of Cummulative Total])),
switch(
TRUE(),
[% of Cummulative Total] <= 0.40, "AA",
[% of Cummulative Total] <= 0.60, "A" ,
[% of Cummulative Total] <= 0.75,"B",
[% of Cummulative Total] <= 0.85,"C",
[% of Cummulative Total] <= 1,"D",
"None"
))

 

shoaibrehman_42_0-1655777138751.png

 

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Please have a try.

Create a measure.

 

coutncolumn = CALCULATE(COUNT('Table'[Class by cumm]),FILTER(ALL('Table'),'Table'[Class by cumm]=SELECTEDVALUE('Table'[Class by cumm])))

 

vpollymsft_0-1655962081797.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Anonymous
Not applicable

Hi Sir, Much appreciate your response for this query, Ok i will explian you , In raw data I have SKU & Order Columns , rest all achived by using DAX Cummulative Total , Cummulative Percentage , Class by Cumm all there is no such coulumns in raw data table.

I have below info to calculate ther metrics & measures , which i have almost done except to count how many A, B & C.

 

Pls let me know if you need more info

shoaibrehman_42_1-1655964142066.png

 

Hi @Anonymous ,

I'm sorry I got a little confused. What is your desired output? Could you please provide you pbix file without privacy information(or some sample data) and desired output with more details( Best output in image form with text explanation)

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi Polly,

 

I have done this on excel by using pivot table and some formulas. Now i am transferring this template on Power Bi.

 

Following is Excel Results.

shoaibrehman_42_0-1655972191568.png

 

Following is the sample data.

 

4.Cummulative total = if(

    NOT(ISBLANK([SUM Of Total OrdersAll])),

    CALCULATE(

        [SUM Of Total OrdersAll],

        FILTER(

            ALL(examp[SKU]),

            SUM(examp[Total Orders])<=[SUM Of Total OrdersAll]

        )

    )

)

 

 

1.SUM Of Total OrdersAll = sum(examp[Total Orders])

 

 

 

2.sum of total orders by SKU = CALCULATE([SUM Of Total OrdersAll],REMOVEFILTERS(examp[SKU]))

 

 

3.% of Orders by Month = DIVIDE([SUM Of Total OrdersAll],[sum of total orders by SKU])

 

 

5.% of Cummulative Total = DIVIDE([Cummulative total],[sum of total orders by SKU])

 

Class by cumm % = if(
NOT(ISBLANK([% of Cummulative Total])),
switch(
TRUE(),
[% of Cummulative Total] <= 0.40, "AA",
[% of Cummulative Total] <= 0.60, "A" ,
[% of Cummulative Total] <= 0.75,"B",
[% of Cummulative Total] <= 0.85,"C",
[% of Cummulative Total] <= 1,"D",
"None"
))

SKUMonth-YYYYTotal Orders

151631601/01/2021545
151631602/01/2021488
1602124012/01/2021332
1602232013/01/2021278
162984907/01/2021191
264390806/01/2021263
264390809/01/2021168
2863006011/01/2021194
6295357014/01/2021317
629589003/01/2021474
6414552010/01/2021199
695913004/01/2021250
695913005/01/2021336
695913008/01/2021387
132411308/02/2021303
151205609/02/202185
151314202/02/2021336
151314201/02/2021442
1602124012/02/2021287
1602232013/02/2021266
162984907/02/2021173
264314705/02/2021166
264390806/02/2021240
2863006011/02/2021199
6295357014/02/2021221
629589003/02/2021273
6414552010/02/2021212
695913004/02/2021248
151631601/03/2021488
151314202/03/2021310
629589003/03/2021289
695913004/03/2021288
264314705/03/2021141
264390806/03/2021217
162984907/03/2021371
132411308/03/2021270
151205609/03/2021442
6414552010/03/2021235
2863006011/03/2021204
1602124012/03/2021263
1602232013/03/2021245
6295357014/03/2021232
151631601/04/20217
151314202/04/2021111
629589003/04/2021218
695913004/04/2021247
264314705/04/2021238
264390806/04/2021293
162984907/04/2021260
132411308/04/2021169
151205609/04/202170
6414552010/04/2021219
2863006011/04/2021189
1602124012/04/2021217
1602232013/04/2021236
6295357014/04/2021249
1516316015/04/20216
1513142016/04/2021199
6295890017/04/2021213
6959130018/04/2021283
2643147019/04/2021333
2643908020/04/2021255
1629849021/04/2021199
1324113022/04/2021250
1512056023/04/2021440
6414552024/04/2021229
2863006025/04/2021236
1602124026/04/2021274
1602232027/04/2021195
6295357028/04/2021194
151631601/06/2021912
151314202/06/2021157
629589003/06/2021204
695913004/06/2021330
264314705/06/2021366
264390806/06/2021245
162984907/06/2021259
132411308/06/20211
151205609/06/2021155
6414552010/06/2021235
2863006011/06/2021249
1602124012/06/2021140
1602232013/06/20216
6295357014/06/202172
151631601/07/2021234
151314202/07/2021480
629589003/07/2021336
695913004/07/2021309
264314705/07/2021345
264390806/07/2021255
162984907/07/2021246
132411308/07/2021277
151205609/07/2021212
6414552010/07/2021230
2863006011/07/2021285
1602124012/07/202142
1602232013/07/2021314
6295357014/07/2021237

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.