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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aggiebrown
Helper III
Helper III

Turning text measure into value DAX

Need help with a simple measure (I think) 
 
New to DAX (swtiching from EXCEL Formulas gives me a bit of a headache.
 
[Cancellation buckets] is a measure, not a table. Due to Dataset Size, I am trying to avoid building new tables, etc.
 
Now I created Cancellation buckets as a measure to nest the Cancellation periods into 4 groups. Now I want to create Measure that will allow me to then count and show Cancellation buckets by count of Cancellations depending on the period.
 
I am trying to achieve this with something similar to COUNTIF in excel, and whereas it gives me a "1", it does not summarise it at the bottom of the table. 
 
I'd appreciate any help.
 
# Cancelled within 30 Days = CALCULATE(IF([Cancellation buckets] = "Cancelled <30 Days",1,BLANK()))
6 REPLIES 6
v-yingjl
Community Support
Community Support

Hi @aggiebrown ,

You can create the measure like this:

# Cancelled within 30 Days = 
VAR tab =
    ADDCOLUMNS (
        ADDCOLUMNS ( 'Table', "CB", [Cancellation buckets] ),
        "Tag", IF ( [CB] = "Cancelled <30 Days", 1, BLANK () )
    )
RETURN
    COUNTX ( tab, [Tag] )

count.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I am not sure how to uppload the updated sample that you attached, but  I created a new measure in your sample, which goes like this, and that works fine. 

 

Cancelled #30 Days = 
var tab =
ADDCOLUMNS
(ADDCOLUMNS('Table', "#30 Days", [Budgets]),"tag", IF( 'Table'[Budgets] <= 30,1, BLANK())
)
RETURN
COUNTX(tab, [tag])

 Based on this how would I create another bucket for "Cancelled 31-60 Days" - using the same calc as I did in the new measure but updating the criteria to greater than 30 or less/equal to 60?

 

@v-yingjl would much appreciate if you could help

Hi,

In an Excel file, share some data and show the expected result.  Upload the file to OneDrive and share the download link here. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @aggiebrown ,

Just write the simliar formula like this:

A =
VAR tab =
    ADDCOLUMNS (
        ADDCOLUMNS ( 'Table', ">30&&<60 Days", [Budgets] ),
        "tag",
            IF ( [Budgets] > 30 && [Budgets] <= 60, 1, BLANK () )
    )
RETURN
    COUNTX ( tab, [tag] )

count.png

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey,

 

This measure does not work on my dataset. I have created a sample, with the relationships I currenlty have in place.

 

The desired look is to drill down to how many Ret plans there were, out of which how many cancelled, and cancelled ones bucketted in 3 different groups, however that calc does not work. I think it's because my first two measures are Cross Filtering the two tables and it should follow the same process right?

aggiebrown_0-1622635058982.png

Example Data File  

Greg_Deckler
Community Champion
Community Champion

@aggiebrown Excel to DAX Translation - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors