Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Maha_0221
Frequent Visitor

calculate % Product codes not sold in all territories?

Expected output

Screenshot 2024-05-17 180307.png

Sample data:

QUANTITYORDERED
30
34
41
45
49
36
29
48
22
PRICEPERUNIT
95.7
81.35
94.74
83.26
100
96.66
86.13
100
98.57
ORDERLINENUMBER
2
5
2
6
14
1
9
1
2
SALES
2871
2765.9
3884.34
3746.7
5205.27
3479.76
2497.77
5512.32
2168.54
ORDERDATE
12/31/2019 0:00
3/12/2020 0:00
5/6/2020 0:00
6/30/2020 0:00
8/15/2020 0:00
9/2/2020 0:00
9/16/2020 0:00
9/23/2020 0:00
10/6/2020 0:00
PRODUCTLINE
Motorcycles
Motorcycles
Motorcycles
Motorcycles
Motorcycles
Motorcycles
Motorcycles
Motorcycles
Motorcycles
MSRP
95
95
95
95
95
95
95
95
95
PRODUCTCODE
S10_1678
S10_1678
S10_1678
S10_1678
S10_1678
S10_1678
S10_1678
S10_1678
S10_1678
COUNTRY
USA
France
France
USA
USA
USA
France
Norway
USA
TERRITORY
NA
EMEA
EMEA
NA
NA
NA
EMEA
EMEA
NA
1 ACCEPTED SOLUTION
v-nuoc-msft
Community Support
Community Support

Hi @Maha_0221 

 

@lbendlin @xifeng_L Thank you very much for your prompt reply, and here allow me to share some of the content.

 

Since you didn't explain the calculation logic, here I assume the following:

 

RESULT = 
var TotalProduct = COUNTROWS('Table')
var selectProductCode = 
    CALCULATE(
        COUNTROWS('Table'), 
        FILTER(
            ALL('Table'), 
            'Table'[TERRITORY] <> "NA" //You can change the filter, for example: 'Table'[TERRITORY] <> "APAC"
        )
    )
RETURN selectProductCode / TotalProduct

 

Here is the result.

 

vnuocmsft_0-1716193620495.png

 

Regards,

Nono Chen

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

 

View solution in original post

5 REPLIES 5
v-nuoc-msft
Community Support
Community Support

Hi @Maha_0221 

 

@lbendlin @xifeng_L Thank you very much for your prompt reply, and here allow me to share some of the content.

 

Since you didn't explain the calculation logic, here I assume the following:

 

RESULT = 
var TotalProduct = COUNTROWS('Table')
var selectProductCode = 
    CALCULATE(
        COUNTROWS('Table'), 
        FILTER(
            ALL('Table'), 
            'Table'[TERRITORY] <> "NA" //You can change the filter, for example: 'Table'[TERRITORY] <> "APAC"
        )
    )
RETURN selectProductCode / TotalProduct

 

Here is the result.

 

vnuocmsft_0-1716193620495.png

 

Regards,

Nono Chen

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

 

xifeng_L
Solution Supplier
Solution Supplier

The example data has only one product code, can you provide more example data and pbix files?

 

And it would be nice to have a demonstration of the calculation logic.

Sample data:

ORDERNUMBERQUANTITYORDEREDPRICEPERUNITORDERLINENUMBERSALESORDERDATESTATUSPRODUCTLINEMSRPPRODUCTCODECOUNTRYTERRITORY
10424501006120014/6/2022 0:00In ProcessClassic Cars214S10_1949SpainEMEA
1042538100125894.944/6/2022 0:00In ProcessClassic Cars147S10_4962FranceEMEA
104244910037969.364/6/2022 0:00In ProcessTrucks and Buses136S12_1666SpainEMEA
104253310044692.64/6/2022 0:00In ProcessTrucks and Buses118S12_4473FranceEMEA
1042454100571824/6/2022 0:00In ProcessTrucks and Buses116S18_1097SpainEMEA
104225195.5524873.054/5/2022 0:00In ProcessVintage Cars102S18_1342USANA
104222551.7511293.754/5/2022 0:00In ProcessVintage Cars53S18_1367USANA
104203710055283.64/4/2022 0:00In ProcessVintage Cars170S18_1749AustraliaAPAC
104252810035318.044/6/2022 0:00In ProcessClassic Cars163S18_2238FranceEMEA
104203663.5742288.524/4/2022 0:00In ProcessVintage Cars60S18_2248AustraliaAPAC
104253899.4173777.584/6/2022 0:00In ProcessTrucks and Buses122S18_2319FranceEMEA

Sample

please do not post links to your reports. 

 

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Maha_0221
Frequent Visitor

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors