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
lcasey
Post Prodigy
Post Prodigy

Why wont the same formula work?

Hello,

 

I have a table I created called countries, it is a simple formula.

 

Countries = Distinct('Transactions'[COUNTRY])

 

This works perfect--No issues and yes there are multiple AND duplicate country values.

 

Region Slicer = DISTINCT(Transactions[Region]) Does Not work In the SAME table. Why do two same exact formulas have different results?

 

I do not want to creat yet a whole other table called Regions. Shouldnt I simply be able to add  regions to the Country Table?

 

01.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You could do it in Power Query with something like this:

let
    Source = Transactions,
    KeptOnlyCountryAndRegion = Table.SelectColumns(Source,{"Country", "Region"}),
    RemovedBlankCountries = Table.SelectRows(KeptOnlyCountryAndRegion, each [Country] <> ""),
    RemovedDuplicateCountryandRegions = Table.Distinct(RemovedBlankCountries)
in
    RemovedDuplicateCountryandRegions

 

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @lcasey,

 

Dose Steve_Wheeler's soution works on your side?

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Your "Country Formula" is a Table, and the "Region Formula" is a measure.

Try change your "Distinct Countries Table Formula" to this:

 

Countries = Distinct( SELECTCOLUMNS(Transactions;"Country Slicer";[Country];"Region Slicer";[Region]) )

 

Hello,

 

This worked as expected, But I am still getting a relation error due to there being Blanks in the data, Unfortunatly, I cant change the dataset and the dataset contains years of previous mispellings etc.  The Current Data though is always correctly entered.

 

Is there a way to filter out Blank Countries as I need to relate tables based on countries?  I am trying to Avoid creating a manual table that needs to be updated. 

 

Countries = Distinct( SELECTCOLUMNS(Transactions,"Country Slicer",[Country],"Region Slicer",[Region]) )

 

01.png

Oops, yeah that's a measure not a column. I mixed up the icons in my head. Still, either way it's not a table.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




KHorseman
Community Champion
Community Champion

It's because you're not creating a new table there. According to your screenshot, you're creating a new column in an existing table (Countries). That's a table formula, not a column formula.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks, That does make sense now, I need to enter a Single formula to get Countries and Regions. 

Anonymous
Not applicable

You could do it in Power Query with something like this:

let
    Source = Transactions,
    KeptOnlyCountryAndRegion = Table.SelectColumns(Source,{"Country", "Region"}),
    RemovedBlankCountries = Table.SelectRows(KeptOnlyCountryAndRegion, each [Country] <> ""),
    RemovedDuplicateCountryandRegions = Table.Distinct(RemovedBlankCountries)
in
    RemovedDuplicateCountryandRegions

 

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.