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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-shex-msft
Community Support
Community Support

Hi @lcasey,

 

Dose Steve_Wheeler's soution works on your side?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.