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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Yutthakorn
Frequent Visitor

Please help how to show data in range between with dax

   
TableInvoicedt 
OcmnumCashName
1100AA
20BB
3500AA
44000CC
53500DD
610000AA

That example data  and i generate series 

Yutthakorn_0-1673323403576.png

 

i want to show data in grid count of range in data

Name0-10001001-20002001-30004000-4001
AA2000
BB1 00
CC0001
DD0001

 

Cash Over = 

Var CashOver = SELECTEDVALUE('Invoicedt'[Cash])

Var CashRange = SELECTEDVALUE(Series[Value])

Var  NameBilling = SELECTEDVALUE(Invoicedt[Name])

Return

        CALCULATE(

            DISTINCTCOUNT(Invoicedt[Ocmnum]),

            FILTER( Invoicedt, CashOver > CashRange && CashOver <= CashRange+1000 && Invoicedt[Name] = NameBilling

            )

    )

i write measure but not show data in grid 

Yutthakorn_1-1673323547140.png

 

1 ACCEPTED SOLUTION
HiraNegi
Resolver II
Resolver II

Hi @Yutthakorn ,

 

Ideally you should generate series in Power Query and then merge join with your data table based on the range. But if you like a simple workaround then you can follow below steps.

 

1. Create series table in DAX with increment of 1.

HiraNegi_0-1673328305822.png

2. Create a group/bin on the Series values with increment of 1000.

HiraNegi_1-1673328412795.png

HiraNegi_2-1673328437980.png

This is what you will get in the Series Table.

HiraNegi_3-1673328472939.png

 

3. Create relation between Series and Data table. If you have decimal values then you can round it to nearest whole number to ensure all data gets to join with Series table.

HiraNegi_4-1673328546433.png

 

4. Now you can create your report using the bins and count from data table.

HiraNegi_5-1673328658188.png

 

Hope this helps.

 

Regards,

Hira Negi

View solution in original post

2 REPLIES 2
HiraNegi
Resolver II
Resolver II

Hi @Yutthakorn ,

 

Ideally you should generate series in Power Query and then merge join with your data table based on the range. But if you like a simple workaround then you can follow below steps.

 

1. Create series table in DAX with increment of 1.

HiraNegi_0-1673328305822.png

2. Create a group/bin on the Series values with increment of 1000.

HiraNegi_1-1673328412795.png

HiraNegi_2-1673328437980.png

This is what you will get in the Series Table.

HiraNegi_3-1673328472939.png

 

3. Create relation between Series and Data table. If you have decimal values then you can round it to nearest whole number to ensure all data gets to join with Series table.

HiraNegi_4-1673328546433.png

 

4. Now you can create your report using the bins and count from data table.

HiraNegi_5-1673328658188.png

 

Hope this helps.

 

Regards,

Hira Negi

vicky_
Super User
Super User

Rather than using a measure, you can acheive the same thing by using grouping / binning. Tutorial here: https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-grouping-and-binning

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.