question

Sahoo-9422 avatar image
0 Votes"
Sahoo-9422 asked CarrinWu-MSFT commented

Compare values from Ranges Table in SSAS Tabular Model DAX

Hi Team,

I am having one table with below details
125476-trans.jpg


and i am defining one table in ssas for Ranges

DEFINE
TABLE Ranges =
DATATABLE (
"Ranges", STRING,
"Min Range", INTEGER,
"Max Range", INTEGER,
{
{ "0-10", 0, 10 },
{ "10-30", 10, 30 },
{ "30-60", 30, 60 },
{ ">60", 60, 100 }
}
)
EVALUATE
Ranges


125511-image.png


Final output:

125409-image.png


Ranges should compare with min and max range from ranges tables . These two table doesn't have relationships.


[2]: /answers/storage/attachments/125408-ranges.jpg

sql-server-analysis-services
trans.jpg (17.6 KiB)
ranges.jpg (15.0 KiB)
image.png (6.2 KiB)
image.png (3.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi@Sahoo-9422, did the answer from AlexeiStoyanovsky help you? If yes, please do "Accept Answer". By doing so, it will benefit for community members who have this similar issue. Your contribution is highly appreciated. Thank you!

0 Votes 0 ·

Hi @Sahoo-9422, could you please do "Accept Answer" if below anwser help you? By doing so, it will benefit for community members who have this similar issue. Your contribution is highly appreciated. Thank you!

0 Votes 0 ·

1 Answer

AlexeiStoyanovsky avatar image
0 Votes"
AlexeiStoyanovsky answered

Apparently you want a calculated column in your one table. Here's one way of coding it:

 Range = 
 var pct = 'one table'[Sales Percentage]
 return CALCULATE(SELECTEDVALUE('Ranges'[Ranges], "no single match"),'Ranges'[Min Range] < pct, 'Ranges'[Max Range] >= pct)

As a side note you might want to tweak the labels for your ranges so it's apparent which boundaries are inclusive and which are exclusive.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.