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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
jasemilly
Helper II
Helper II

create measure that returns best customer between months use in a textbox

Hi Everyone

I trying to show which customer has improved the most, compared to the previous month. 

 

I would use, the smart narrative visual to acheive this but I am using Zebra BI custom visuals as the main visual, Power bi informs these two items don't work together.

So, I would like to create a measure ,that I can use in the Text box.  Displaying something like "This month Customer, "   X "has changed the most compared to last month"

 

X been the result of the measure


I already have a measure that calculates the variance between the 2 months.  

I placed a card on the report, then put the customer name in the field well and applied the filter topN  = 1  on the variance measure all works great.

I then used the performance analyzer to capture the generated Dax.  

 

Total mom Overhead Top Change = 
  
  VAR __DS0FilterTable = 
    TREATAS({2021}, 'Periods'[Year])

  VAR __DS0FilterTable2 = 
    TREATAS({"January"}, 'Periods'[Month Name])

  VAR __SQDS0Core = 
    SUMMARIZECOLUMNS(
      'DimNLNominalAccount'[AccountName],
      __DS0FilterTable,
      __DS0FilterTable2,
      "Total_MoM__ABS_Overheads", 'A_Measure'[Total MoM  ABS Overheads]
    )

  VAR __SQDS0BodyLimited = 
    TOPN(1, __SQDS0Core, [Total_MoM__ABS_Overheads], 0)

Return
  SUMMARIZECOLUMNS(
    __DS0FilterTable,
    __DS0FilterTable2,
    __SQDS0BodyLimited,
    "MinAccountName", IGNORE(CALCULATE(MIN('DimNLNominalAccount'[AccountName])))
  )

 

Now when I try to use the measue for the card I get the following error,

 

SummarizeColumns() and AddMissingItems() may not be used in this contet.

 

This is the same dax that works fine on the original card, where I manually set it up.


Thanks to everyone in advance for help and suggestions.

1 REPLY 1
lbendlin
Super User
Super User

Use SUMMARIZE() insted.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors