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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX measure: how many stores have more than 65% of documents per article

Hi all,

I need some help to create DAX measures in PowerBI.  

I need to create a table (final table) where you can see per article

  • How many distinct stores have the article
  • how many documents there are for the article
  • how many stores have more than 65% of documents per article
    • in the summary table you see the sub calculation for this
  • which stores have more than 65% of documents per article

In the dashboard there will be a slicer so user can filter the data.

Below an example in Excel.

Picture1.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And here the sample data:

StoreDocumentArticleDate
Zellik1zeep2018
Aalst2zeep2018
Brussel3zeep2018
Parijs4zeep2019
Aalst5zeep2020
Brussel6zeep2021
Parijs7zeep2021
Brussel8zeep2020
Parijs9zeep2021
Gent10brood2018
Brugge11brood2018
Parijs12brood2019
Brussel13brood2019
Brussel14brood2019
Brussel15brood2019
Brussel16brood2021
Ostende17brood2021
Ostende18brood2021
Brussel19brood2021
Brussel20brood2021
Brussel21brood2021
Brussel22brood2021
Brussel23brood2021
Brussel24brood2021

 

Hope someone can help!
Julie

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

 

Picture1.png

Distinct Stores per article: =
COUNTROWS( VALUES( Data[Store] ))
 
Count Docs per article: =
COUNTROWS( VALUES( Data[Document] ))
 
Stores count >65%: =
VAR newtable =
SUMMARIZE ( Data, Data[Article], Data[Store] )
VAR add_columns =
FILTER (
ADDCOLUMNS (
newtable,
"@docscount", [Count Docs per article:],
"@alldocscount", CALCULATE ( [Count Docs per article:], ALLEXCEPT ( Data, Data[Article] ) )
),
[@docscount] / [@alldocscount] > 0.65
)
RETURN
COUNTROWS ( add_columns )
 
Stores name >65%: =
VAR newtable =
SUMMARIZE ( Data, Data[Article], Data[Store] )
VAR add_columns =
FILTER (
ADDCOLUMNS (
newtable,
"@docscount", [Count Docs per article:],
"@alldocscount", CALCULATE ( [Count Docs per article:], ALLEXCEPT ( Data, Data[Article] ) )
),
[@docscount] / [@alldocscount] > 0.65
)
RETURN
CONCATENATEX( add_columns, Data[Store], ", ")

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

 

Picture1.png

Distinct Stores per article: =
COUNTROWS( VALUES( Data[Store] ))
 
Count Docs per article: =
COUNTROWS( VALUES( Data[Document] ))
 
Stores count >65%: =
VAR newtable =
SUMMARIZE ( Data, Data[Article], Data[Store] )
VAR add_columns =
FILTER (
ADDCOLUMNS (
newtable,
"@docscount", [Count Docs per article:],
"@alldocscount", CALCULATE ( [Count Docs per article:], ALLEXCEPT ( Data, Data[Article] ) )
),
[@docscount] / [@alldocscount] > 0.65
)
RETURN
COUNTROWS ( add_columns )
 
Stores name >65%: =
VAR newtable =
SUMMARIZE ( Data, Data[Article], Data[Store] )
VAR add_columns =
FILTER (
ADDCOLUMNS (
newtable,
"@docscount", [Count Docs per article:],
"@alldocscount", CALCULATE ( [Count Docs per article:], ALLEXCEPT ( Data, Data[Article] ) )
),
[@docscount] / [@alldocscount] > 0.65
)
RETURN
CONCATENATEX( add_columns, Data[Store], ", ")

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.